Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Programmatically add folder to classpath

807603Dec 21 2007 — edited Dec 21 2007
How 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 18 2008
Added on Dec 21 2007
4 comments
192 views