You see a Windows RegCreateKeyEx(…​) returned error code 5 warning message on the console, but no functionality is affected.

What happens ?

When you run a Lucy-based application or the LuciadLightspeed demo, the console prints harmless warnings such as these:

java.util.prefs.WindowsPreferences#<init> Could not open/create prefs
root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...)
returned error code 5.

Note that this warning does not affect any of the functionality of Lucy or the LuciadLightspeed demo.

Why does this happen?

Lucy and the LuciadLightspeed demo both use the java.util.prefs.Preferences mechanism to make certain settings persistent. On Windows, those persistent settings are stored in the registry. The warning message is triggered when the Software\JavaSoft\Prefs node cannot be created in the registry.

Both Java 7 and Java 8 suffer from an issue with the Preferences mechanism, which prevents Java from storing preferences at system level (see JDK-8138597 in the JDK bug database). Luciad has no control over that issue. However, because Lucy as well as the LuciadLightspeed demo store their preferences at a user level, the problem does not affect those applications. In spite of the warning message, they work just fine.

How can I remove the warning ?

There are three known workarounds to this problem:

  • Configure Java’s logging system so that it doesn’t show the warning. You can add the following lines to your logging configuration file, so that the warning isn’t shown in your logs.

    # reduce the log level for the java.util.prefs package, because it always
    # logs warnings about the systemRoot of the preferences, even if the application
    # only ever uses the userRoot.
    # see JDK issue
    java.util.prefs.level = SEVERE

    You can specify the logging configuration flag using the java.util.logging.config.file system property. See the API documentation of Java’s LogManager for more information.

  • Run and close the application at least once with administrator rights. If you run the application once as an administrator, the necessary nodes will be created in the registry. The next time you run the application as a regular user, you won’t see the warning anymore.

  • Manually create the node in the Windows registry:

    1. Go to the Windows Start Menu and type regedit in the search field to start the Registry Editor.

    2. Navigate to the path HKEY_LOCAL_MACHINE\Software\JavaSoft in the Registry Editor.

    3. Right-click the JavaSoft folder and select New→Key.

    4. Name the key Prefs.

    5. Close the Registry Editor.