Read a file within a jar from java code present in same jar
问题 I am trying to read a xsd file kept in a jar using java code kept inside the same jar. I am using the following code. URL tmpurl = ClassLoader.getSystemResource("com/abc/filename.xsd"); Schema s = schemaFactory.newSchema(tmpurl); jaxbUnMarshaller.setSchema(s); It is working fine when I run it as a separate project but when I make a jar, tmpurl is null, hence the setSchema gives a null pointer exception. Can you please a workaround that can make it run even inside a jar file. 回答1: Hava you