Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8139507

WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs

XMLWordPrintable

    • b123
    • x86
    • windows_7

        FULL PRODUCT VERSION :
        java version "1.8.0_60"
        Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
        Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.1.7601]

        A DESCRIPTION OF THE PROBLEM :
        The warning:
          Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
        is printed to stderr. This happens when accessing the userRoot.

        This happens at least for jre installations of jre 1.7.0_21 and higher on a 'clean' Windows system. Installation of older jre versions create the key
          HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs
        Versions 1.7.21 and later and 1.8.0 and later do NOT.
        Removing older version do not seem to remove the existing HKLM key. That is why this issue only occurs with installations on 'clean' Windows systems.
        With an existing HKLM Prefs key, no warnings are generated.

        ******
        This issue was reported earlier, see JDK-8038489. It was closed because it was said to be not reproducible.
        It is however reproducible if HLKM\SOFTWARE\JavaSoft\Prefs is not present, like on clean Windows systems or if manually removed.

        UAC is enabled, user which installs and runs is member of Administrators.

        As I am not able to reopen it, I submit this as a new one with a little more detail on how to reproduce.

        ADDITIONAL REGRESSION INFORMATION:
        Last worked in 1.7.0_13

        JRE 1.8.0 installer does NOT create the HKLM Prefs key
        JRE 1.7.0_21 (and higher) installer does NOT create the HKLM Prefs key
        JRE 1.7.0_13 installer does create the HKLM Prefs key
        _15 and _17 never tested.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Remove
          HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs
        from Windows registry. This 'Prefs' key is present if you ever had an older java version installed.

        If you want you can install JRE/JDK 1.8.0_60, the Prefs key will not be created. Running the source code without the Prefs key in HKLM will report the warning.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        No warning

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        Oct 09, 2015 9:47:43 AM java.util.prefs.WindowsPreferences <init>
        WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        package Bugs;

        import java.util.prefs.Preferences;

        public class PrefsWarning {

          void findPrefs() {
            Preferences prefs = Preferences.userRoot();
          }

          public static void main(String[] args) {
            PrefsWarning pw = new PrefsWarning();
            pw.findPrefs();
          }

        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Create HKLM Prefs key manually in Windows Registry
        - or -
        Install (very) old jre before installing a recent one.

              jlahoda Jan Lahoda
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: