[求助] 急! 明天面试!读取不取properties文件
PS: dao.properties文件已经在classes根目录下了...
代码:
private Properties prop = null;
private String daoClass = null;
public Factory()
{
try
{
prop = new Properties();
InputStream in = ClassLoader.getSystemResourceAsStream("dao.properties"); //问题出现在这里读不到dao.properties文件
System.out.println("in:"+in); //总是打出null
prop.load(in);
daoClass = prop.getProperty("dao.class");
}
catch (Exception e) {
e.printStackTrace();
}
}
在线急等~~~~~~~~