February 28th, 2006, 11:41 AM
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, 04:35 PM
how are you trying to access the file?
March 1st, 2006, 12: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 07:44 AM.