我正在使用Struts2和IDE Eclipse。我有一個chart.xml
文件,該文件被放置在WEB-INF文件夾中,我試圖讀取該文件爲:從Eclipse的WEB-INF文件夾讀取文件
String path=ServletActionContext.getServletContext().getRealPath("/WEB_INF/chart.xml");
File XMLfile = new File(path);
但是無法讀取它。我收到以下錯誤:
javax.xml.bind.UnmarshalException
- with linked exception:
[java.io.FileNotFoundException: F:\doc\Mavenex\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\EFW11\WEB-INF\chart1.xm (The system cannot find the file specified)]
我該怎麼辦?
您可以將該文件放在F:\ doc \ Mavenex \ .metadata \ .plugins \ org.eclipse.wst.server.core \ tmp1 \ wtpwebapps \ EFW11 \ WEB-INF \此目錄中。 –
感謝您的回覆,我需要找到WEB-INF文件夾的確切位置 – user3090158