Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are the Java preferences stored in Windows 7?

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.

like image 265
javamonkey79 Avatar asked Feb 09 '11 16:02

javamonkey79


People also ask

Where are Java preferences stored on Windows?

The user preferences are typically stored at user-home/. java/. userPrefs . The user preferences location can be overridden by setting the system property java.

What are preferences in Java?

The Java Preferences API provides a systematic way to handle program preference configurations, e.g. to save user settings, remember the last value of a field etc. Preferences are key / values pairs where the key is an arbitrary name for the preference. The value can be a boolean, string, int of another primitive type.

What is userPrefs?

The userprefs. xml file contains a series of ParameterName elements that contain a ParameterValue element. The names of the parameters you can set are contained in the ParameterName elements. Enter the value for these parameters in the associated ParameterValue elements.


1 Answers

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

like image 55
AlexR Avatar answered Sep 21 '22 02:09

AlexR