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 than 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 gets 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
This (and the concept of multi-user systems with no write access to application directories for regular user accounts) is the reason why user data should be kept in the user’s home directory, and not anywhere near the app installation folder.