When executing Java code that communicates with the Windows machine — particularly when using the find-bugs Maven plugin or 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.
Solution
Create two registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\PrefsHKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\JavaSoft\Prefs
Steps to Fix
- Open the Registry Editor (
Win + R→ typeregedit→ Enter) - Navigate to
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node - Right-click on
WOW6432Node, select New → Key and name it JavaSoft - Create a Prefs key within JavaSoft
- Repeat steps 3–4 for the
HKEY_LOCAL_MACHINE\SOFTWAREpath