Read / Write XML file from Java application bundle

Posted by Peter on Stack Overflow See other posts from Stack Overflow or by Peter
Published on 2010-05-04T17:52:15Z Indexed on 2010/05/04 17:58 UTC
Read the original article Hit count: 255

Filed under:
|
|

Hi there!

I've got an XML file that is parsed and written in my application. From within my IDE (Eclipse) I simply address it like this:

Reading:

private String xmlFile = "file.xml";

and then I build the document:

doc = sax.build(xmlFile);

Writing is done like this:

writer = new FileWriter("file.xml");

Runs great so far, but after bundling my application, the file is no longer accessible. What exactly do I have to do to make it accessible from within an application bundle? I'm absolutely not familiar with the classpath or whatever I need for that, so please go easy on me!

Thank you very much!

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml