I have developed Java desktop application using Netbeans.
In my application, I used some properties files and I placed it under the Project folder so that I can access it by using code like that
Properties props = new Properties();
props.load(new FileInputStream("config.properties"));
But when I deploy and package my application to .jar file, I can’t find out where properties files are and my application can not read value from properties files.
How can I fix that bug, and where should I place my properties file and load it?
Put it under
/src/resources/, then use it like below.NetBeans doesn’t include the files under your project directory. Further, you need to build the project, in order to let NetBeans put the
propertiesfile inside your/classesdirectory. Then you should be able to pick it up, by running your application or just a particular related Java class.Cheers.