Are you trying to get the properties file from the current working directory or trying to get it as a resource? Sounds like you should use.
InputStream is = getClass().getResourceAsStream(filename); properties.load(is);
to download a file from the current directory
properties.load(new FileInputStream(filename));
My guess is what you really need.
try { Properties pro = new Properties(); pro.load(new FileInputStream("pos_config.properties")); String pos_id = pro.getProperty("pos_id"); try { global_variables.station_id = Integer.parseInt(pos_id); } catch(Exception e) { global_variables.station_id = 0; } String shop_type = pro.getProperty("shop_type"); try { global_variables.shop_type = Integer.parseInt(shop_type); } catch(Exception e) { global_variables.shop_type = 0; } } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); }
source share