Get location from where the Java code is executed
Posted
by drasto
on Stack Overflow
See other posts from Stack Overflow
or by drasto
Published on 2010-04-21T10:48:12Z
Indexed on
2010/04/21
11:13 UTC
Read the original article
Hit count: 171
I have a swing Java application that preserves a lot of data (you can think of a game and its saves for example). Those data are stored in files rather then in database.
I would like to keep this files near installation files(.jar file) of my application.Some users(like me) are used to delete default application folder of OS when it comes to large and I don't want them to loose their data this way.
Any ideas how to do this easily ? How do I get the folder of the .jar file from program that is executing form that .jar file? Or how do I output files directly into some package? How do I create packages(folders inside jar) dynamically ? Or is there a simple way to distribute Java application in other formats then .jar and then store generated data in installation (sub)folder ?
Thanks for reading
© Stack Overflow or respective owner