February 28th, 2006, 12:41 PM
Path to file in JAR
I've got xml files in my source folder which I want to add to a JAR file. However when I added them to the JAR and put add the JAR to the build path, the paths which previous pointed to these files now throw "file not found" exceptions. Therefore the path that throws the error is
I'm just wondering what should I change the path to so that it can reference my xml file in the JAR
Thanking you in advance
February 28th, 2006, 05:35 PM
how are you trying to access the file?
March 1st, 2006, 01:21 AM
To access a file inside a JAR, you need to create a URL, like so:
URL yourURL = Classname.class.getResource("path/to/your/file.xml");
Last edited by Rambone; March 1st, 2006 at 08:44 AM.