new File xml

i'm trying to get an set a file to an xml file, but it only works if i know exactly where the file is located on the system. i want to add it from my projects resources.

File file =new File(getClass().getResource("catalog.xml").toString());

is what i would like, but doesn't work.

File file =new File("c:/catalog.xml");

works, but not how i want it to work

[507 byte] By [ChisMa] at [2007-11-26 16:51:34]
# 1
so getClass() and getResource(String) are both methods in your project?Could you post the code to those methods?
KrimsonEagla at 2007-7-8 23:19:17 > top of Java-index,Java Essentials,Java Programming...
# 2
getResource returns a URL -- and URLs are not the same thing as file system paths. Why create a file at all? Why not:InputStream in = getClass().getResourceAsStream("catalog.xml")
DrLaszloJamfa at 2007-7-8 23:19:17 > top of Java-index,Java Essentials,Java Programming...