properties web 读取不到

properties 在编译以后读取不到

ClassLoader classLoader = Thread.currentThrea().getContextClassLoader();
InputStream in = classLoader.getResourceAsStream(" /const.properties");
Properties prt = new Properties();
try {
prt.load(in);
} catch (FileNotFoundException e1) {

e1.printStackTrace();
} catch (IOException e) {

e.printStackTrace();
}
properties 文件放在src下 后来在文件名前加了个“/”就能读取了
"/****"表示根目录

你可能感兴趣的:(thread,Web)