Where are the Java preferences stored in Windows 7?

JavaWindows 7Preferences

Java Problem Overview


We use the Java preferences in some of our apps and haven't really noticed this since the utility that makes the calls is fairly old and was written in Windows XP days. But it seems the Java preferences are no longer stored in the registry in Windows 7 - or they are stored somewhere different.

I'm expecting it to be in:

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs

But I don't see it there.

What makes it wierder, is that when I run this app:

public static void main( final String[] args ) throws BackingStoreException {

	Preferences systemRoot = Preferences.systemRoot();
	Preferences preferences = systemRoot.node( "com/mycompany/settings" );

	systemRoot.put( "foo", "bar" );
	systemRoot.put( "baz", "lolz" );
	System.out.println( "-------------------------------" );

	String[] keys = preferences.keys();
	for( String key : keys ) {
		System.out.println( key );
	}

	System.out.println( "-------------------------------" );

	keys = systemRoot.keys();
	for( String key : keys ) {
		System.out.println( key );
	}
}

It actually writes (I can comment the put out and run it again and it works) but I don't see the new keys in the registry.

Also, I can't seem to see this documented anywhere. Thanks in advance.

EDIT #1 The only reason this matters is that the setting changes dependent upon which environment it is ran. This being said, it is often useful to simulate that environment by inserting the registry keys manually and then doing some checking.

I was running as admin, yet I did not see the keys in the registry where I expected them to be.

Java Solutions


Solution 1 - Java

They are under current user: HKEY_CURRENT_USER\Software\JavaSoft\Prefs

Solution 2 - Java

for systemRoot:

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\...

for userRoot:

HKEY_CURRENT_USER\SOFTWARE\JavaSoft\...

Solution 3 - Java

I had a similar problem when I worked with systemRoot preferences and with the help of a registry monitor I discovered that the location where they are stored changes depending on if the Windows operating system is 32-bit or 64-bit.

Under 32bit OS (Windows XP in my case) the systemRoot registry path was

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs

Under 64bit OS (Windows 7 in my case) the systemRoot registry path was

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Prefs

The same 32-bit JRE (JRE 1.6.0_20-b02) was used on both systems.

When running a 32-bit application (the JVM) on a 64-bit windows the registry automatically inserts the Wow6432Node path element to allow for applications compiled for either 32-bit or 64-bit to co-exist on the same machine while keeping their settings separate.

Solution 4 - Java

Some preferences are stored in registry keys, while some others (now I'm going to check exactly which ones) seem stored in text files; for instance, the preference "Use certificates and keys in browser keystore" is stored in C:\Users\%USER%\AppData\LocalLow\Sun\Java\Deployment\deployment.properties :

#deployment.properties
#Thu Jun 12 15:26:53 CEST 2014

deployment.security.browser.keystore.use=false

deployment.modified.timestamp=1402579613914
deployment.version=7.21
deployment.browser.path=C\:\\Program Files\\Mozilla Firefox\\firefox.exe
#Java Deployment jre's
#Thu Jun 12 15:26:53 CEST 2014
deployment.javaws.jre.0.registered=true
deployment.javaws.jre.0.platform=1.7
deployment.javaws.jre.0.osname=Windows
deployment.javaws.jre.0.path=C\:\\Program Files\\Java\\jre7\\bin\\javaw.exe
deployment.javaws.jre.0.product=1.7.0_60
deployment.javaws.jre.0.osarch=x86
deployment.javaws.jre.0.location=http\://java.sun.com/products/autodl/j2se
deployment.javaws.jre.0.enabled=true
deployment.javaws.jre.0.args=

This was verified on Windows 7 pro / 32 bit - JRE 1.7.0_60 (i586)

sources:
Related question on this site
Oracle - Java SE documentation - Deployment Configuration File and Properties

Have a nice day

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionjavamonkey79View Question on Stackoverflow
Solution 1 - JavaAlexRView Answer on Stackoverflow
Solution 2 - JavabestsssView Answer on Stackoverflow
Solution 3 - JavaErik EmanuelssonView Answer on Stackoverflow
Solution 4 - JavaEdgar GrillView Answer on Stackoverflow