For the [FILES] section:
[Files]
Source: "jre-6u17-windows-i586-s.exe"; DestDir: "{app}\JRE 1.6"; Flags: onlyifdoesntexist
For the [CODE] section:
[Code]
Function JREInstallPrompt:Boolean;
begin
if ((msgBox ('Do you want to install JRE 1.6?',mbinformation,mb_YesNo)=idYes)) then
begin
msgBox ('JRE 1.6 will being installing now. Please do not restart the machine or log off until it is complete!',mbinformation,mb_OK);
Result:=True;
end
else Result:=False;
end;
Function JREVerifyInstall:Boolean;
begin
if ((RegValueExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\JavaSoft','InstallerVersion')) or (JREInstallPrompt=False)) then //Exists or do not install
Result:=False
else Result:=True;
end;
And for the RUN section:
[Run]
;SQL Server Express 2005 Installer
Filename: "{app}\JRE 1.6\jre-6u17-windows-i586-s.exe"; WorkingDir: {app}\JRE 1.6; StatusMsg: Installing Java Runtime Environment... Please Wait...;Check:JREVerifyInstall
Hopefully that will get you pointed in the right direction.