lundi 11 avril 2016

ClassNotFoundException after loading jar

I have two jar's, I load the second jar into the first and all of it's classes with URLClassLoader. I can use all the classes in the loaded jar during the application without issues. However I tried to export an object whose class i from the loaded jar using ObjectOutputStream. Exporting worked however when I tried to import the object again with ObjectInputStream I get a ClassNotFoundException

If I'm loading all the classes from the jar at the beginning (before I import the object), how can it not find the class? Of course the class does not exist in the first jar I thought that since I had loaded the classes from the second jar, it would be able to find the class.





Aucun commentaire:

Enregistrer un commentaire