I am having trouble finding a configuration file using classpath.
I use:
InputStream stream = myclass.class.getResourceAsStream("properties.file");
The properties file is located in the config directory.
When you run the program with eclipse, it works. I just added the configuration folder to the class path in the startup configuration.
But if I want to run the exported jar as follows:
java -jar -cp C:\project\lib;C:\project\config myclass.jar
I get a wonderful java.lang.NullPointerException because it cannot find the file.
It sounds classic and stupid, but I can't find any clues. What does an eclipse do, what am I not doing?
thanks
source share