我正在尝试从我的 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>.
谢谢