Java classpath and config file
- by user1228291
I'm having some trouble finding a config file with classpath.
I use :
InputStream stream = myclass.class.getResourceAsStream("properties.file");
The properties.file is located under config directory.
When running the program with eclipse, it works.
I just added config folder in the classpath in the launch configuration.
But If I want to run the exported jar like this :
java -jar -cp C:\project\lib;C:\project\config myclass.jar
I get the oh wonderful java.lang.NullPointerException because it can't find the file.
This sounds classic and stupid but I can't find a clue.
What does eclipse do that I don't ?
Thanks