Programmatically add folder to classpath
807603Dec 21 2007 — edited Dec 21 2007How can I programmatically add a folder (either on the local filesystem or through a URL across a network) to the classpath? If I'm trying to load a file test.properties, and I do a ResourceBundle.getInstance("test"), I'd like the folder that I add to the classpath to be searched in the process of finding test.properties. (I'd therefore need to add test.properties's containing folder to the classpath.)
The reason I need to do this programmatically is because within this web application, we're unable to modify the packaged WAR file or make the resources available to other web contexts by placing it in the common library directory of the web server. And being a web application, of course setting the CLASSPATH environment variable or setting the cp command-line flag won't help.
Thanks.