dimanche 3 mai 2015

Java sun.misc.Launcher$AppClassLoader breaking code?

So, I have a classloader, ReflectionClassLoader, which I'm using to dynamicly load JAR files from various places, in order to play with obfuscated code environments.

This works fine in my IDE, and is quite fun to play with, but when I export a setup in Eclipse, I find that my Class Loader is being loaded by the standard URLClassLoader, and a sun.misc.Launcher$AppClassLoader, so loaded twice. Since it stores certain data, like resources, loaded classes, etc, it's completely breaking my system. In eclipse, their both loaded by the sun.misc.Launcher$AppClassLoader.

The second loading appears to be evident at where my custom URL protocol (debugrsrc) is loaded. I've tried getting the System ClassLoader, and reflecting, but that returns the sun.misc.Launcher$AppClassLoader, even though it's not returning that in my main method.

It seems to be completely isolated from the rest of the program. As for an escape, I'm thinking of pulling some Unsafe, although I'd much prefer to just have Sun not mess with ClassLoaders.

Aucun commentaire:

Enregistrer un commentaire