簡體   English   中英

Inno Setup:如何檢查 JRE 是否存在並提示下載?

[英]Inno Setup: How to check if JRE is present and prompt to download if not?

我正在使用 Inno Setup 為 Java 64 位應用程序開發安裝程序。

Inno Setup 可以檢查計算機中是否存在 Java 64 位,如果沒有,則向用戶顯示下載 Java 64 位的鏈接?

我應該向 Inno Setup 腳本添加什么來實現該行為?

您可以在下面找到一個腳本,該腳本可以檢查是否安裝了 JRE,然后向我使用此 Stack Overflow 帖子作為參考的用戶提示消息:如何從 Inno Setup 安裝 JRE?

[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;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM