I am trying to read / write the windows registry on 64bit Win7 using JAVA.
Firstly, I tried to use the JDK java.util.prefs.Preferencesand use its reflection . This is a good solution, but it only supports reading / writing a value of type REG_SZ (string).
Unfortunately, I need to read / write REG_BINARY, so discard it.
Secondly, I tried JNI Registry . Reading is fine, but writing usually fails, because you need administrator privileges to write HKLM. I do not know how to get admin rights in JAVA.
Finally, I tried JNA (Java Native Access) a great project for working with native libraries and supports the Windows registry in the platform library (platform.jar) through Advapi32Utiland Advapi32. It is very good and easy to use. And for the registry entry does not require any administrator rights.
But how can I read / write a 32-bit registry (under the WOW6432Node node) in a 64-bit JVM on Win7?
By default, 64-bit nodes are read / written in 64-bit JVMs and 32-bit nodes in 32-bit JVMs.
But in a 64-bit JVM, I want to read / write 32-bit nodes (for example, HKLM->SOFTWARE->Wow6432Node->ODBC). How can i do this?
source
share