我正在使用 Inno Setup 开发 Java 64 位应用程序的安装程序。
Inno Setup 可以检查计算机中是否存在 Java 64 位,如果没有则向用户显示 Java 64 位下载链接?
我应该在 Inno Setup 脚本中添加什么来实现该行为?
最佳答案
您可以在下面找到一个脚本,该脚本可以检查是否安装了 JRE,然后为用户提示一条消息我使用这篇 Stack Overflow 帖子作为引用:How do I install a JRE from an Inno Setup?
[Code]
{ Script to check if a JRE is installed }
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
JavaVer: string;
begin
RegQueryStringValue(
HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVer);
Result := (Length(JavaVer) > 0);
if not Result then
begin
if MsgBox('YOUR MESSAGE GOES HERE', mbConfirmation, MB_YESNO) = idYes then
begin
ShellExec(
'open', 'https://www.java.com/en/download/manual.jsp#win',
'', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
end;
end;
关于java - Inno 安装程序 : How to check if JRE is present and prompt to download if not?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54055927/