Reputation: 39
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
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