Hey, I am having a problem here accessing a User specified folder at runtime. The actual scenario is, i need to get all the .class file from a user specified folder, or a .jar file and display them as a list. To do this i have to have the specified folders path in the CLASSPATH, that i am able to set using the Runtime class. But my problem is how to make my already running application to recognise the new CLASSPATH, so that it can retrieve the files in that folder. is there any way that i can do this or do i have to shut down my application and restart it once again. I am on it for the last one week, please help me out if you can.
You create an instance of a java.net.URLClassLoader that includes the new 'classpath' elements and loads the Classes for you. The following example loads Classes from a jar, but can be modified to include directories as well. When including directories, you need to include the trailing slash on the directory eg new File("extraDir/")