I’m trying to build a runnable JAR using Eclipse’s Export function. everything works fine except several .properties files I have under the root directory.
I added all the .properties files into Build Path, and they appears under ‘Order and Export’ tab in Java Build Path dialog.
However, when I try to run the Export, I got the following errors:
Could not read JAR file ‘log4j.properties’. Reason: error in opening zip file
error in opening zip file
error in opening zip file
The Runnable JAR file is actually created, but with no .properties files in it. why does it try to export .properties files as ZIP files? how to make this work?
Eclipse Build id: 20090621-0832
This is based on memory, but I’m fairly sure that properties files aren’t automatically loaded from a jar. The idea is that the properties files should be easily modifiable. Otherwise, the values might as well just be in a class file.
If you tried to access a properties file from anywhere else, this shouldn’t be a problem.
This is also why you seldom see jar files packaged alone. There is usually something else that needs to be loaded.
Is there a reason this behavior is necessary?