exception
java.io.FileNotFoundException: E:\Java Web\eclipse-jee-neon-3-win32-x86_64\eclipse...\scenery.xml (系统找不到指定的文件。)
java.io.FileInputStream.open0(Native Method)
java.io.FileInputStream.open(FileInputStream.java:195)
java.io.FileInputStream.(FileInputStream.java:138)
java.io.FileInputStream.(FileInputStream.java:93)
sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
报错的路径是我的eclipse存放的路径
我该怎么写路径。
public class SceneryXML extends HttpServlet{
File file = new File ("/appnews/src/scenery.xml");
protected void doGet (HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
DocumentBuilderFactory bdf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = null;
try {
db = bdf.newDocumentBuilder();
} catch (ParserConfigurationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Document document = null;
try {
document = db.parse(new File("/appnews/src/scenery.xml"));
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}