我正在使用Inno Setup创建一个安装程序,该安装程序安装了还包含JRE的应用程序,但是最近Oracle更改了Java许可模型,并且我不再可以随应用程序一起分发JRE。
我基本上想下载JRE并将其解压缩到一个文件夹中,作为安装的一部分。
我发现很少的插件(InnoTools Downloader),但这似乎不适用于Oracle。可能是因为许可协议。如何在我的代码中接受许可协议,然后继续安装和提取?
#define ITDRoot ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','InstallPath','')
#include ITDRoot+'\it_download.iss'
[Files]
Source: {#ITDRoot}\languages\*.ini; Flags: dontcopy
[Code]
{ EXAMPLE 4
In this example, a translation for the UI is read from a file. If the
language name from the [Languages] section matches the one in the filename
of an ITD language file, it is used. Otherwise, English is used.
}
{Load the ITD language file that corresponds to Inno's selected
language}
procedure LoadITDLang;
var lang:string;
begin
lang:=ExpandConstant('{language}');
try
ExtractTemporaryFile('itd_'+lang+'.ini');
ITD_LoadStrings(expandconstant('{tmp}\itd_'+lang+'.ini'));
except
{We get here if the selected language wasn't included in the
set of ITD translation files. In this case, just use ITD's
built in translation file (English), by not loading anything.
Note that the exception will still appear while debugging -
you can turn this off in Inno Setup Compiler options
("Pause on exceptions"), or just ignore it. It doesn't appear
at runtime.}
end;
end;
procedure InitializeWizard();
begin
itd_init;
LoadITDLang;
//Let's download two zipfiles from my website..
itd_addfile('http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jre-8u171-windows-x64.tar.gz',expandconstant('{tmp}\dogz5.zip'));
itd_addfile('http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jre-8u171-windows-x64.tar.gz',expandconstant('{tmp}\petz4.zip'));
//Start the download after the "Ready to install" screen is shown
itd_downloadafter(wpReady);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssInstall then begin //Lets install those files that were downloaded for us
filecopy(expandconstant('{tmp}\dogz5.zip'),expandconstant('{app}\dogz5.zip'),false);
filecopy(expandconstant('{tmp}\petz4.zip'),expandconstant('{app}\petz4.zip'),false);
end;
end;
最佳答案
我如何在我的代码中接受许可协议,然后继续进行安装和提取
几乎不。即使您设法绕过Oracle站点上的所有检查,对检查的任何更改也将破坏安装程序。
此外,通过自动执行下载,您将以相同的方式违反许可证,就好像您直接将JRE包含在安装程序中一样。
您最好向用户显示一些说明,然后为他/她打开下载页面。
顺便说一句,do not use InnoTools Downloader, use Inno Download Plugin or DwinsHs instead(在特定情况下不起作用)。
关于java - 如何使用Inno Setup下载JRE作为安装的一部分,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51098150/