OK, no other answers, so I'll have a go.
This is coding on wild side! You use refection to break into private methods that are not part of the public API. Even if you get this to work now, there's no guarantee that it won't break in the very next minor Java update. Seems dangerous to me.
Anyway, try it without the HKEY_LOCAL_MACHINE\\ in your key, I think that's already implied by systemRoot.
If you want a safer way to approach this, you can use ProcessBuilder to run the command line registry tool reg.exe, and stick to published public APIs. I can let you have some sample code if you want to try it.
Reputation Points: 1895
Solved Threads: 942
Posting Expert
Offline 5,741 posts
since Apr 2008