I have a big issue doing something really stupid. That is to say open a stream to a resource file in my META-INF folder. I am working on a jar tool and on doing this:
<try this path: META-INF/schema.xsd
(first /
omitted)
Try removing first slash:
InputStream schemaIS = this.getClass().getClassLoader().getResourceAsStream("META-INF/schema.xsd");
You need a leading slash if you are calling the getResourceAsStream
method on a Class
object. On a ClassLoader
object, the path is always absolute, and the leading slash is not necessary.