I have made some kind of library, and it needs some xml files so i have stored them in a resource folder and i load it like it like this:
MyClass.class.getClassLoader().getResourceAsStream("resources/somefile.xml");
Everything works fine when running from the same jar. However, if i decide to export this code as a .jar and import it as an external jar from another program, the above code fails to get the resource. How can i do this correctly?
Note: Actually the jar file is an android library jar (android project marked as library in eclipse), it seems to work fine in my android app, but since it is just a library i want to test it out in a non android app, everything works fine except for getting the resource file. Should i write the library as a simple java project?