String classpath=test.class.getResource("/").getFile();
String f = classpath.toString()+"setting.properties";
log.info(f);
Properties props = new Properties();
//props.load(test.class.getResourceAsStream(f));
props.load(new FileReader(f, StandardCharsets.UTF_8));
String filepath = props.getProperty("last_open_file");
String interval = props.getProperty("auto_save_interval", "120");
log.info(filepath);
log.info(interval);
props.setProperty("url", "http://www.liaoxuefeng.com");
props.setProperty("language", "Java");
props.store(new FileOutputStream("D:\\\\conf\\\\setting.properties"), "这是写入的properties注释");
// 存到setting.properties文件里的注释显示的是ASCII编码#\u6CE8\u91CA
// 整个工程是utf-8编码。?
Sign in to make a reply
净净一隅
String classpath=test.class.getResource("/").getFile();
String f = classpath.toString()+"setting.properties";
log.info(f);
Properties props = new Properties();
//props.load(test.class.getResourceAsStream(f));
props.load(new FileReader(f, StandardCharsets.UTF_8));
String filepath = props.getProperty("last_open_file");
String interval = props.getProperty("auto_save_interval", "120");
log.info(filepath);
log.info(interval);
props.setProperty("url", "http://www.liaoxuefeng.com");
props.setProperty("language", "Java");
props.store(new FileOutputStream("D:\\\\conf\\\\setting.properties"), "这是写入的properties注释");
// 存到setting.properties文件里的注释显示的是ASCII编码#\u6CE8\u91CA
// 整个工程是utf-8编码。?