【发布时间】:2021-09-13 13:30:40
【问题描述】:
我需要访问我的 jar 中的 xsd 文件。我的问题是我的类路径是 C:\Users\fabio\Documents。
我的jar文件也在那个路径下,那我怎么才能得到我需要的文件呢?
我尝试了 File xsdFile=new File(String.valueOf(MigrationsApplication.class.getResource("DBRegister.xsd")));,但收到此错误消息 schema_reference.4: Failed to read schema document 'file:/C:/Users/fabio/Documents/null', 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 file jar getresource