KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a property file which is inside a default package and the class in which I am using the properties file is also in the same default package. If I use just the file name without any path I am getting error. Obviously that is not correct as I should give some kind of path to refer to tat file. I will build the application make it as a jar file so how should I give the path as the properties file should go inside that jar file. I am using Netbeans IDE. EDIT Properties pro = new Properties(); try { pro.load(new FileInputStream("pos_config.properties")); pro.setProperty("pos_id", "2"); pro.setProperty("shop_type", "2"); pro.store(new FileOutputStream("pos_config.properties"), null); String pos_id = pro.getProperty("pos_id"); if(pos_id.equals("")){ pos_id="0" ; } global_variables.station_id = Integer.parseInt(pos_id); String shop_type = pro.getProperty("shop_type"); if(shop_type.equals("")){ shop_type="0" ; } global_variables.shop_type = Integer.parseInt(shop_type); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); }
Tags (comma-separated)
Save Edits
Cancel