【发布时间】:2013-08-06 19:16:16
【问题描述】:
我正在尝试从我的 WAR 文件中获取一个文件。
URL url2 = getClass().getClassLoader().getResource("/package.xsd");
当我打印getPath() 时,输出如下:
/C:/workspacesFresh2/.metadata/.plugins/org.eclipse.wst.core/tmp1/wtpwebapps/GServer/WEB-INF/lib/GLibrary.jar!/package.xsd
所以,它找到了package.xsd,但我无法使用该路径打开它。
关于如何访问该文件的任何想法?
错误:
org.xml.sax.SAXParseException; schema_reference.4: Failed to read schema document 'file:/C:/workspacesFresh2/.metadata/.plugins/org.eclipse.server.core/tmp1/wtpwebapps/Server/WEB-INF/lib/GLibrary.jar!/package.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
谢谢
【问题讨论】:
-
你能定义“打不开”吗?任何错误?堆栈跟踪?
-
我已经收录了
标签: java url path classloader war