views:

25

answers:

2

We have a Java Web Start application and are trying to store application configuration data using HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER. We can get someone with admin rights to launch the app the first time and set the configuration, so that it will store the values in the registry successfully. Nevertheless, subsequent Vista users without admin privileges cannot seem to even read the values from the registry in HKEY_LOCAL_MACHINE.

Perhaps our approach is incorrect, and there is a better way to store application configuration data. Can anyone help?

+1  A: 

I may be wrong, but non admin users don't have access to HKLM period. Read or write.

If possible, store your settings in HKCU. Have the app contain default settings and if the HKCU values are not found, then the defaults are used and stored in the registry. The user should then have the ability to change those values.

Joao
Thanks for answering. You have confirmed our suspicions that non-admin users don't have access to HKLM. Our dilemma is that there is nowhere to store the application config data unique to the organization implementing our software, that subsequent users (not the original installer) without admin privileges could read. We have achieved a work-around using the ALLUSERSPROFILE environment setting and writing app-config to the file instead of the registry.
Curtis Jones
+1  A: 

You normally use java.util.Preferences to store application specific data on the client machine. On Windows machines this will behind the scenes be written into the Windows registry. Here's a Sun tutorial/guide and a more technical article about the subject.

If you'd like to get more access to the Windows registry, then you may find the jRegistryKey API useful, but this would of course work only when the webstart application is executed on Windows machines and not on Linux/Mac/etc. The java.util.Preferences API is more abstract in that.

BalusC
We are using ALLUSERSPROFILE and writing to a file store in it instead of the registry as a workaround. Is there anywhere in the registry to store the application config data unique to the organization implementing our software that subsequent users (not the original installer) without admin privileges could read? Or, is our approach to write to the ALLUSERSPROFILE environment folder a good approach.
Curtis Jones