This content has been marked as final. Show 1 reply
You can get the actual URL of the source JAR file per object, via Class.getProtectionDomain().getCodeSource().getLocation(). So each object only needs its own single classpath URL in the annotation.
However the annotations are only written once per class per stream, not with every object. You may not save quite as much as you think.
It would make more sense not to download the JARs and to create the URLClassLoader using their original locations. Downloading will still take place but only on-demand as required. In fact unless the client is running an HTTP server surely this is exactly what is really happening?