简体   繁体   English

NSIS:无法从Windows 7 64位的注册表中获取JRE版本

[英]NSIS: Unable to get JRE version from registry in Windows 7 64 bit

I'm using NSIS script to generate the windows installer for my Java project. 我正在使用NSIS脚本为我的Java项目生成Windows安装程序。 In this installer, I want to check whether the computer has the right JRE version before proceeding. 在此安装程序中,我想在继续之前检查计算机是否具有正确的JRE版本。

This is my code snippet for getting the JRE version:- 这是我获取JRE版本的代码片段: -

ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"

# display $1 value for testing purpose
MessageBox MB_OK "Version: $1"

This code works fine in Windows XP, but I can't get it to work in Windows 7 64 bit... the version number is always blank. 此代码在Windows XP中运行良好,但我无法在Windows 7 64位中运行...版本号始终为空。 I check the registry, and I'm pretty sure the path is correct and "CurrentVersion" has a value. 我检查注册表,我很确定路径是正确的,“CurrentVersion”有一个值。

Can anyone tell me what I do wrong here? 谁能告诉我这里做错了什么?

Thanks much! 非常感谢!

在NSIS中,您可以使用SetRegView设置注册表“mode”

Is the installer 32 bit and the runtime 64 bit or vice versa? 安装程序是32位还是运行时64位,反之亦然? In that case you might get redirected to different registry nodes (inside HKLM/Software or HKLM/Software/Wow6432Node). 在这种情况下,您可能会被重定向到不同的注册表节点(在HKLM / Software或HKLM / Software / Wow6432Node内)。

The NSIS installer is a 32 bit program so it sees a different part of the registry. NSIS安装程序是一个32位程序,因此它可以看到注册表的不同部分。 This knowledge base article explains the difference in the registry on 64 bit Windows. 这篇知识库文章解释了64位Windows上注册表的不同之处。

http://support.microsoft.com/kb/305097 http://support.microsoft.com/kb/305097

I'm not entirely sure if you can access the key you need from a 32 bit app or not. 我不完全确定你是否可以从32位应用程序访问所需的密钥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM