I have packaged my application in a jar file. The application uses the following code to read from the properties file: <pre> InputStream propStream = getClass().getClassLoader(). getResourceAsStream(propertiesFile); props.load(propStream); </pre> When I run the application, it cannot find the properties file unless I package it inside the jar file. Is there some way to set my classpath so that it can find the properties file outside of the jar file? Thanks Geoffrey
Well, the way that we do it is - we jar the classes up. Then we create a bat file that explicitely calls the class that has the main in it using the properties file as a parameter myApp.bat javaw -cp .;app.jar;otherjars; StartThisClass myAppProperties.properties < end-file> Then we have the user start the application using an icon pointing at the .bat file Of course that means that you can not just double click the jar file and expect it to work.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Aug 17, 2001
Thanks. But I would rather do it using a classpath that includes the properties file. I wonder if I am using the wrong ClassLoader? Secondly, is there a way to set the Classpath in the manifest of the jar file? Thanks Geoffrey