The following is known to work, always, everywhere:
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("System/entities.xml");
If it doesn't work, you might not have the JAR in your classpath.
That unfortunately returned null aswell :s
Also I'm not sure how to add the jar to the classpath since all I do is copy some resources and compiled class files from another jar.
Have a read of the javadoc; it explains how the path is resolved.
If the resource name begins with '/', then the path is absolute - taken from the root of the class path. (i.e. it will find resources that reside in what would be otherwise called the default package
Otherwise, the resource is relative to the package folder of the Class you are invoking the method upon.
will give the same results as:
I'm not sure why your initial example doesn't work; you might need to show a little more of your code structure. What package is Main.class
in? is it in the same archive as "/System/entities.xml"?
That image shows the root-folder in my jar file. Main.class is located in the Game folder while my entities.xml file is located in the System folder.
I'm going to write my own class loader and see if that works. Thanks for your help guys, I really appreciate it