-1

如何通过 Java 中的注册表获取 Windows ProductID?我尝试的唯一方法是通过:

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

它返回 null 或错误。

提前致谢。

4

1 回答 1

0

我使用相同的方法来获取 Windows ProductID。它在 jdk_1.6.0.26 (x64) 上对我有用,但在 jdk_1.6.0.06 (x86) 上却没有,因为我已经安装了 Win7x64。

PD:我使用Java 从读/写到 Windows 注册表的 WinRegistry 实现,如果您考虑上述评论,它就可以工作。

于 2012-06-15T15:28:20.220 回答