我们试图使用fileInputStream读取servlet中的属性文件。FileInputStream在Web应用程序中不起作用
但是,我们是constanlty获取文件未找到异常。
这是一段代码,我们在使用的getResourceAsStream它工作正常使用
Properties properties = new Properties();
File propertyFile = new File("config" + File.separatorChar + "abc.properties");
try {
FileInputStream propertyFileStream = new FileInputStream(propertyFile);
properties.load(propertyFileStream);
propertyFileStream.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
。
但是我们需要理解为什么FileInputStream不起作用。
我们已将config \ abc.properties文件放入webInf中。我们也尝试将它放在src文件夹(java classpath),webContent文件夹,WebInf \ Classes文件夹中但没有成功。
不工作?你无法获得房产价值? –
这是给FileNotFOundException – user123
,我打电话给它的网络应用程序 – user123