William
William

Reputation: 39

Export Jar runnable in Eclipse with output function to an xml file

I am exporting a Swing application to a runnable Jar in Eclipse. The Swing application takes some inputs and write it to a XML file, which I hard coded the location to be "C:/runnable/example.xml".

It works fine in Eclipse but when I deploy the app, I don't know where the generated XML goes. Can somebody tell me how I can write some data to an external file in a runnable JAR?

Upvotes: 0

Views: 119

Answers (1)

Andrew Thompson
Andrew Thompson

Reputation: 168835

Can somebody tell me how I can write some data to an external file in a runnable JAR?

Write the output to a (sub-)directory of user.home. That is a path that is stable across runs and should be writable by the app.

Upvotes: 1

Related Questions