2

I'm using Inno Setup to create an installer which installs my app which also contains JRE but recently Oracle has changed the Java licensing model and I no longer can distribute the JRE with my application.

I basically want to download JRE and extract it in a folder as part of my installation.

I have found few of the plugins (InnoTools Downloader) but that didn't seem to work with Oracle. Possibly because of the license agreement. How do I accept license agreement in my code and then proceed with the installation and extraction?

#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;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
skr
  • 1,700
  • 1
  • 15
  • 39

1 Answers1

1

how do i accept license agreement in my code and then proceed with the installation and extraction

Hardly. And even if you manage to bypass all the checks on Oracle site, any change to the checks would break your installer.

Moreover by automating the download, you would violate the license the same way, as if you include JRE directly in the installer.

You better show some instructions to the user, and open the download page for him/her.


Btw, do not use InnoTools Downloader, use Inno Download Plugin or DwinsHs instead (not that it helps in this particular case).

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992