Similar question was already ask here and there're a lot of good answers. I choosed the piece of code from the 1. answer and with given good example could read some value from Windows Registry (WR).
Can anyone give me a good example please to write an entry (valueName and Value) in WR? I'm not familiar with Java and that's why it's a little complicated for me to understand it without example:(
The main Key is HKEY_LOCAL_MACHINE
, Subkey is Software\\Wow6432Node\\mySoft
. The valueName and value that I want to write are: myPwd
and a
.
Thanks!
Asked
Active
Viewed 349 times
0
1 Answers
1
Please refer back to the same link here first answer to use the provided class WinRegistry, and then you can use its function writeStringValue
For example, in your case:
WinRegistry.writeStringValue( WinRegistry.HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\mySoft", "myPwd", "a" );
-
I've already used this function, but the entry didn't appear in my WR. I thought I could be because of my redused rights on the computer, but there was also no `Exception` like `IllegalAccessException`. The function is just being called but nothing more appears. Do you know what could be the reason for it? – Usam Jun 02 '16 at 08:11
-
you can debug this line `Preferences systemRoot = Preferences.systemRoot();` to see if you can get it fine with permission. Alternatively, which JVM u use? if 64bit, please try to copy 64bit version of WinRegistry provided from other answers of the same link – Doan Linh Jun 02 '16 at 12:28