The getResource method returns you a URL object, so the code you have posted should not compile. At any rate, assuming your real code looks more likethen -- also assuming the resource is actually in the file system and not inside the jar -- then I think calling its getPath() method should give you the file name. A little experimenting with System.out.println should show you what you are dealing with. [ April 26, 2006: Message edited by: Paul Clapham ]
Joined: Mar 27, 2006
yeah sorry about that. In my real code i wrote:
The problem I've notice and completely confused by is that when i call a f.exists() it returns false, even though i know it definitely does exist! ive been using loads of System.out.println() lines to try to find out whats going on.
when i change the code and use File f = new File("folder/thefile.xml"); it works fine. but the code then reads the file from OUTSIDE of the JAR, even though the file and folder exist inside the JAR.
im totally confused! please help! [ April 26, 2006: Message edited by: Ben Wong ]