mardi 31 mai 2016

how to add jar dynamically and put it at the beginning of the search path

I met a problem when using Java

let's say , when a java program start , it loads jarA , jarB , jarC (i can not control this step) , and in JarA , JarB , jarC they all have a class called "Demo" . and now in the code , i need to use "Demo" class from jarD

using ClassLoader , i can add jarD, but how can i make sure that , the "Demo" when i called ClassLoader.loadClass("Demo") give the class defined in jarD (not that class has the same name in jarA ,jarB , jarC)

thanks and looking forward to the answers !





Aucun commentaire:

Enregistrer un commentaire