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
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 :
So it's not really Registry access.
Originally posted by Ernest Friedman-Hill:
Surely there's a command-line registry-twiddlin' doohickey out there somewhere (there might even be one bundled with Winders.)
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.
PS: If you have a whole slew of changes to make, you could generate a reg file and run
regedit /s filename.reg
See Distributing Registry Changes
or generate an inf file and run
rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 filename.inf
See MS Windows NT Workstation Deployment Guide - Automating Windows NT Setup
[ September 30, 2005: Message edited by: Peer Reynders ]