seejayou
17th December 2002 18:07 UTC
Preinstall check
Hi,
I am wanting to check the version of Java Runtime installed before I allow my application to install. I want it to be a minimum of 1.4
Function .onInit
ReadRegStr $R0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion" CurrentVersion
StrCmp $R0 "1.4" NoAbort 0
MessageBox MB_OK "JRE not high enough"
Abort ; causes installer to quit.
NoAbort:
FunctionEnd
The above is what I currently have but this doesn't appear to work. I would really like to convert the $R0 to an int so I can use the IntCmpU and use the if greater than check as well rather than having to change the code everytime that a new JRE is released.
Any help much appreciated.
C.
rarefluid
17th December 2002 20:27 UTC
Try this :
The CurrentVersion is a Value, not a key, so you have to state the name seperate... ;-)
onInit
StrCpy $R9"14" ;add java version here or define it somewhere...
>ReadRegStr $R0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
>StrCpy $R1 $R0 1 ;get first number
StrCpy $R2 $R0"" 2 ;get rest of number
StrCpy $R1"$R1$R2" ;concate version numbers
IntCmp $R1 $R9 version_ok"" version_ok
StrCpy $R1 $R1 1 ;get first number again
StrCpy $R3 $R9 1 ;get first number of needed version
StrCpy $R4 $R9"" 1 ;get rest of needed version
MessageBox MB_OK "JRE not high enough.$\r$\nYou have version $R1.$R2$\r$\nVersion $R3.$R4 is needed"
>Abort ; causes installer to quit.
>version_ok:
>FunctionEnd
>
hope it helps
KIM
seejayou
17th December 2002 21:33 UTC
Thanks, Got it all working...once I took the quotes off from CurrentVersion.
Thanks for you help.
C.