Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在JAVA中通过注册表获取Windows ProductID_Java - Fatal编程技术网

在JAVA中通过注册表获取Windows ProductID

在JAVA中通过注册表获取Windows ProductID,java,Java,如何在Java中通过注册表获取Windows ProductID?我尝试的唯一方法是: Process p = Runtime.getRuntime().exec("reg query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\" /v ProductId"); 返回null或error 提前感谢。我用同样的方法获得了Windows产品ID。 它在jdk_1.6.0.26(x64)上对我有

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

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


提前感谢。

我用同样的方法获得了Windows产品ID。 它在jdk_1.6.0.26(x64)上对我有效,但在jdk_1.6.0.06(x86)上没有,因为我安装了Win7x64

PD:我从中使用了WinRegistry的实现,如果您考虑上面的评论,它会起作用。

有关如何访问Windows注册表的一些重要提示,请参阅和。