Hi Friends, is there a pure java based solution for accessing the windows registry. I read in the Core Java(Sun Publications), that because the registry is a pure windows based concept(component), java don't have any api's for accessing windows registry and you need to go to JNI. Is that so?. Any suggetions are welcome. Thanks in advance
Yes, that is so. The Java API is platform independent, so you will not find platform specific things in there, for example to access the Windows registry.
You could program your own solution using JNI (create some C or C++ code that calls the Win32 API to access the registry), or use one of the libraries available on Internet, for example: http://sourceforge.net/projects/jregistrykey
Originally posted by Ulf Dittmer: Actually, it's not so. Starting with Java 1.4, the java.util.prefs package does provide access to the Windows registry. On other platforms (Unix et al.), it is mapped to files.
Well...yes and no. In the current implementation on windows, the Preferences is mapped to a node in the Registry, but that's not guaranteed. Also, you have NO access to any registry keys other than the ones under :
Surely there's a command-line registry-twiddlin' doohickey out there somewhere (there might even be one bundled with Winders.) An alternative to JNI would be to use Runtime.exec() to launch that program.
However, you still can only change what the user has rights to - so there still is a good possibility that it won't work for a "limited account". But you could generate a .bat file and then use runas. This could also be of interest.