Fix Java Windows Registry Warning

Evgeniy Fitsner Software Engineer
2 min read
Fix Java Windows Registry Warning

The Problem

When executing Java code that interacts with the Windows registry - particularly when using the FindBugs Maven plugin or running IntelliJ IDEA - you may encounter the following warning:

1
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

Error code 5 means “Access Denied.” The Java Preferences API attempts to store system-level preferences in the Windows registry but lacks the necessary permissions to create the required registry keys.

Solution

Create the missing registry keys with appropriate permissions:

  • HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs
  • HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft\Prefs

Step-by-Step Fix

  1. Open the Registry Editor by pressing Win + R, typing regedit, and pressing Enter.

  2. Navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node.

  3. Right-click on WOW6432Node, select New then Key, and name it JavaSoft.

  4. Inside the new JavaSoft key, create another key named Prefs.

  5. Repeat steps 2 through 4 for the HKEY_LOCAL_MACHINE\SOFTWARE path (without the WOW6432Node portion).

After creating both keys, the warning will no longer appear when running Java applications.

Contents