I have ran into a problem concerning classloaders in Java.
For some reason I have encrypted a class with AES, when my program starts it decrypts the class using a key provided by a web service. I have written my own classloader which calls super.defineClass(String, byte[], int, int)
which works 100%
But when I create a thread (lets say swing) and use the class I decrypted previously it throws an exception where the magic number is wrong which is understandable (compilation version messed up due to classloading). However the class works perfectly fine when I do not use it in a thread which is not an option.
How would I fix this?