hi, follwing scenario: an app downloads a jar file and creates objects from classes stored in this jar. how do i load classes from this jar file (the file is not in the classpath -> its not found by the system class loader) is there a way how i can add a jar file to the classpath dynamicaly ? or do i have to create a URLClassloader and load all the classes trough reflection ? thanks karl
You can't dynamically set the classpath at runtime. The classpath system property that is set when starting the VM can be modified at runtime, but the system classloader is already configured with the classpath status at VM start time by then. You'll have to use a custom classloader to load your classes, or you could use the URLClassLoader you mentioned. Regards, G�nther http://www.javacoding.net
karl koch
Ranch Hand
Joined: May 25, 2001
Posts: 388
posted
0
thanks. i did it with the URLClassloader and it works. k