public class proUtil { public static Map<String, String> map = new HashMap<String, String>(); static{ String parasource = System.getProperty("os.name").toLowerCase().startsWith("win")?"parameter.properties":"parameter_linux.properties"; //InputStream in = ToolService.class.getClassLoader().getResourceAsStream(parasource); try { InputStreamReader in = new InputStreamReader(ToolService.class.getClassLoader().getResourceAsStream(pparasource), "UTF-8") ; Properties p = new Properties(); p.load(in); map.put("key", p.getProperty("key")); ......... }catch (Exception e) { e.printStackTrace(); } } } |
|