-1

How do I get the Windows ProductID via registry in Java? The only way I tried is via:

    Process p = Runtime.getRuntime().exec("reg query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\" /v ProductId");

which returns null or error.

Thanks in advance.

  • 1
    Refer to http://stackoverflow.com/questions/585804/accessing-windows-registry and http://stackoverflow.com/questions/62289/read-write-to-windows-registry-using-java for some great tips on how to access the Windows registry. – Ewald May 18 '12 at 07:47

1 Answers1

0

I used the same way to get the Windows ProductID. It's worked for me on jdk_1.6.0.26 (x64), but it hasn't on jdk_1.6.0.06 (x86), because I've installed Win7x64.

PD: I used the implementation of WinRegistry from read/write to Windows Registry using Java and it works if you considering above comment.

Community
  • 1
  • 1
Trauco
  • 41
  • 3