Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect first time user in java app

I want my java desktop application to know if the user is running it for the first time on that pc. Since the jar-file might be shared between users i don't want to write to a file inside the jar-file. There are obviously a lot of ways to do this but what would you recommend? (It has to be cross-platform). thanks

like image 334
l.lukian Avatar asked Nov 29 '11 18:11

l.lukian


2 Answers

I would recommend using the users home directory where you can place a user specific settings file. This will allow you to detect first time users as well as remember any preferences they may choose.

System.getProperty("user.home"); // returns the home directory cross platform
like image 73
Neil Essy Avatar answered Nov 04 '22 09:11

Neil Essy


Try to use Preferences and its systemRoot() or userRoot() methods to obtain system-wide or user-specific preferences.

like image 33
szhem Avatar answered Nov 04 '22 10:11

szhem