Detect first time user in java app

后端 未结 3 701
太阳男子
太阳男子 2021-01-13 07:35

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 t

相关标签:
3条回答
  • 2021-01-13 08:07

    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
    
    0 讨论(0)
  • 2021-01-13 08:08

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

    0 讨论(0)
  • 2021-01-13 08:09

    Every OS has some specific directories where the user data is stored (/home, C:\Users, C:\Documents and settings). This value is usually available in the JVM with the "user.home" System property.

    Store there some file to store your user configuration. Of course, each OS has its way of doing that ("Application Data" folder, folder with a name that begins with a dot), you should be sure that you comply with it.

    0 讨论(0)
提交回复
热议问题