properties 在编译以后读取不到
ClassLoader classLoader = Thread.currentThrea().getContextClassLoader();
InputStream in = classLoader.getResourceAsStream("[u]/[/u]const.properties");
Properties prt = new Properties();
try {
prt.load(in);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
properties 文件放在src下 后来在文件名前加了个“/”就能读取了
"/****"表示根目录
ClassLoader classLoader = Thread.currentThrea().getContextClassLoader();
InputStream in = classLoader.getResourceAsStream("[u]/[/u]const.properties");
Properties prt = new Properties();
try {
prt.load(in);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
properties 文件放在src下 后来在文件名前加了个“/”就能读取了
"/****"表示根目录