Preference API storage

后端 未结 2 1147
情书的邮戳
情书的邮戳 2020-12-15 16:53

If I use the Preference API to store user or system preferences, where are they stored on Windows and Unix?

2条回答
  •  Happy的楠姐
    2020-12-15 17:17

    I have to extend n002213fs' answer, because it seems to me, that the Storage Location is a big mess. Note that Windows saves it in the Windows Registry and Unix saves it in prefs.xml-files.

    userRoot

    • Windows (32Bit): HKEY_CURRENT_USER\Software\JavaSoft\Prefs
    • Windows (64Bit) with JVM (64Bit): HKEY_CURRENT_USER\Software\JavaSoft\Prefs
    • Windows (64Bit) with JVM (32Bit): HKEY_CURRENT_USER\Software\Wow6432Node\JavaSoft\Prefs
    • Unix: System.getProperty("java.util.prefs.userRoot") or (if the previous value is not set) ~/.java/.userPrefs

    systemRoot

    • Windows (32Bit): HKEY_LOCAL_MACHINE\Software\JavaSoft\Prefs
    • Windows (64Bit) with JVM (64Bit): HKEY_LOCAL_MACHINE\Software\JavaSoft\Prefs
    • Windows (64Bit) with JVM (32Bit): HKEY_LOCAL_MACHINE\Software\Wow6432Node\JavaSoft\Prefs
    • Unix: System.getProperty("java.util.prefs.systemRoot") or (if the previous value is not set) System.getProperty("java.home")+"/.systemPrefs" (System.getProperty("java.home") might be /etc/.java/. You can check it in a terminal with $JAVA_HOME.)

提交回复
热议问题