I am using .properties file for my project and Netbeans 6.9.1 IDE. How can I add my properties file into the code?
String prop="c:\\Config.properties";
Properties Config= new Properties();
Config.load(new FileInputStream(prop));
f1=Config.getProperty("f1");
f2=Config.getProperty("f2");
How can I define my Build path instead of "c:\\Config.properties"?
Is there any way to add this file directly to the project?
You could put the config.properties into one of your packages and then define the path to your properties file relative.
ClassLoader.getResourceAsStream ("your/app/package/config.properties");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With