Friday, February 20, 2015

WindowsPreferences WARNING: Could not open/create

While running GWT (Google Web Toolkit) applications in Eclipse on Windows, you might encounter the following warning:

feb 20, 2015 4:13:54 pm 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.

Answer is:
This happens because the Java runtime cannot access or create the Windows registry node where it stores preferences.

Why This Happens

Java stores preferences for applications in the Windows registry at HKEY_LOCAL_MACHINE\Software\JavaSoft\Prefs.

If this key doesn’t exist or your user doesn’t have administrator rights, Eclipse/GWT cannot write preferences, causing this warning.

Error code 5 indicates access denied.

Step-by-Step Fix
1. Open the Registry Editor

Press Windows + S (search) and type:

regedit


Press Enter to open the Registry Editor.
Be careful when editing the registry; incorrect changes can affect your system.

2. Navigate to JavaSoft Key

Go to the following path in the Registry Editor:

HKEY_LOCAL_MACHINE\Software\JavaSoft

3. Create the Prefs Key

Right-click the JavaSoft folder.

Choose New → Key.

Rename the new key to:

Prefs

4. Verify Permissions

Ensure that your user account has read/write permissions on the Prefs key.

If needed, right-click → Permissions → Add your user and give Full Control.

5. Restart Eclipse

Close Eclipse and restart it.

The warning should no longer appear when running your GWT application.

Additional Notes

This warning is harmless in most cases, but fixing it ensures that preferences are saved properly.

If you are using a 64-bit Windows system and 32-bit Java, the path might be:

HKEY_LOCAL_MACHINE\Software\Wow6432Node\JavaSoft


Always back up your registry before making changes.


Wednesday, February 11, 2015

Convert .zip file to .war file

If you need to convert .zip file to .war file, go through following steps.

Method 1: Simple Rename (if .zip already has WAR structure)

1. Copy the .zip file into your project directory.
Example: HelloWorld.zip

2. Open a terminal or command prompt.

3. Run the rename command:

Windows (cmd):

ren HelloWorld.zip HelloWorld.war


Linux/macOS (bash):

mv HelloWorld.zip HelloWorld.war


Now you can deploy HelloWorld.war into your application server (Tomcat, GlassFish, WildFly, etc.).