Function ManageJVM Call CheckJVM Pop $R0 StrCmp $R0 "0" 0 +2 ;If the JRE is not up to date or missing, install it. Call LaunchJVMSetup StrCpy $R0 $R0; Dummy action. :D FunctionEnd Function CheckJVM Push $R0 Push $R1 ReadRegStr $R0 HKLM "Software\JavaSoft\Java Runtime Environment" "CurrentVersion" StrCmp $R0 "" 0 +2 StrCpy $R0 "0.0" Push $R0 Push "1.4" ;I need v1.4 or later of the JRE Call VersionCheck Pop $R0 StrCmp $R0 "2" 0 +3 StrCpy $R0 "0" ;The JRE is not up to date or missing Goto +2 StrCpy $R0 "1" ;The JRE is up to date Pop $R1 Exch $R0 FunctionEnd Function LaunchJVMSetup Push $R0 Push $R1 StrCpy $R0 "$EXEDIR\JVM_SUN\j2re-1_4_2-win-i586.exe" ;path to the JRE setup executable StrCpy $R1 "/s /v$\"/qn IEXPLORER=1 REBOOT=Suppress$\"" ExecWait '"$R0" $R1' Pop $R1 Pop $R0 FunctionEnd ; function versioncheck ; by Hendri Adriaens ; HendriAdriaens@hotmail.com Function VersionCheck Exch $R0 ; second version number Exch Exch $R1 ; first version number Push $R2 Push $R3 Push $R4 StrCpy $R2 0 Loop1: IntOp $R2 $R2 + 1 StrCpy $R3 $R0 1 -$R2 StrCmp $R3 "" Loop1_Exit StrCmp $R3 "." 0 Loop1 StrCpy $R3 $R0 -$R2 IntOp $R2 $R2 - 1 StrCpy $R4 $R0 "" -$R2 StrCpy $R0 "$R3$R4" Goto Loop1 Loop1_Exit: StrCpy $R2 0 Loop2: IntOp $R2 $R2 + 1 StrCpy $R3 $R1 1 -$R2 StrCmp $R3 "" Loop2_Exit StrCmp $R3 "." 0 Loop2 StrCpy $R3 $R1 -$R2 IntOp $R2 $R2 - 1 StrCpy $R4 $R1 "" -$R2 StrCpy $R1 "$R3$R4" Goto Loop2 Loop2_Exit: StrLen $R2 $R0 StrLen $R3 $R1 IntCmp $R2 $R3 Compare 0 Loop3_Exit IntOp $R2 $R3 - $R2 StrCpy $R3 0 Loop3: IntOp $R3 $R3 + 1 StrCpy $R0 "$R00" StrCmp $R3 $R2 Compare Loop3 Loop3_Exit: IntOp $R2 $R2 - $R3 StrCpy $R3 0 Loop4: IntOp $R3 $R3 + 1 StrCpy $R1 "$R10" StrCmp $R3 $R2 0 Loop4 Compare: StrCpy $R0 "1$R0" StrCpy $R1 "1$R1" IntCmp $R0 $R1 0 OneIsNewer TwoIsNewer StrCpy $R0 0 Goto Done OneIsNewer: StrCpy $R0 1 Goto Done TwoIsNewer: StrCpy $R0 2 Done: Pop $R4 Pop $R3 Pop $R2 Pop $R1 Exch $R0 ; output FunctionEnd