JediKnight2
19th December 2006 17:52 UTC
Help with script
OK. I have waded thru the Java detect script and have fixed the script. It will detect java correctly and prompt to install if needed. ONE problem remains that I just cant figure out. If Java is NOT installed or is OLD, the program CORRECTLY prompts to install the Java package, installs it then moves to install the program. If Java IS installed, however, it DOES skip the java warnings but moves to install java anyway??? Can someone take a look for me.
sag47
19th December 2006 18:34 UTC
Look at your code:
Function DetectJRE
ReadRegStr ${TEMP} HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
ReadRegStr ${TEMP2} HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\${TEMP}" "JavaHome"
Goto GetJRE
GetJRE:
IfFileExists "${TEMP2}\bin\java.exe" 0 NoFound
StrCpy ${VAL1} ${TEMP} 1
StrCpy ${VAL2} ${JRE_VERSION} 1
IntCmp ${VAL1} ${VAL2} 0 FoundOld FoundNew
StrCpy ${VAL1} ${TEMP} 1 2
StrCpy ${VAL2} ${JRE_VERSION} 1 2
IntCmp ${VAL1} ${VAL2} FoundNew FoundOld FoundNew
A possible fix:
Change IfFileExists "${TEMP2}\bin\java.exe" 0 NoFound to the following.
IfFileExists "${TEMP2}\bin\java.exe" "" NoFound
In another installation I had errors with IfFileExists using a 0 in that blank function field. Replace it with quotes and let me know how it goes.
In fact I recommend using quotes to show blank fields instead of a 0. It seemed to cure all my errors
SAM
JediKnight2
19th December 2006 18:48 UTC
Nope...that didnt fix it..
I hopefully explained what it was doing correctly...like I said it is detecting that I have the correct JRE version...but it is going into the JRE install anyway..for instance..say I dont have JRE installed it comes up with a screen that tells them no JRE is present...they press next and a window comes up unzipping the JRE and installing it after that is complete it goes to the program install...well right now if the PROPER JRE is found no warning about JRE is shown but it goes straight to the JRE install...
JediKnight2
19th December 2006 20:30 UTC
For some reason I think it is in this section...
Function CheckInstalledJRE
Call DetectJRE
Pop ${TEMP}
StrCmp ${TEMP} "OK" NoDownloadJRE
Pop ${TEMP2}
StrCmp ${TEMP2} "None" NoFound FoundOld
FoundOld:
!insertmacro MUI_INSTALLOPTIONS_WRITE "jre.ini" "Field 1" "Text" "TGDTJ requires a more recent version of the Java Runtime Environment than the one found on your computer.\nThe installation of JRE ${JRE_VERSION} will start."
!insertmacro MUI_HEADER_TEXT "$(TEXT_JRE_TITLE)" "$(TEXT_JRE_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "jre.ini"
Goto DownloadJRE
NoFound:
!insertmacro MUI_INSTALLOPTIONS_WRITE "jre.ini" "Field 1" "Text" "No Java Runtime Environment could be found on your computer.\n The installation of JRE v${JRE_VERSION} will start."
!insertmacro MUI_HEADER_TEXT "$(TEXT_JRE_TITLE)" "$(TEXT_JRE_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "jre.ini"
Goto DownloadJRE
DownloadJRE:
StrCpy ${DOWNLOAD_JRE_FLAG} "Download"
Return
NoDownloadJRE:
Pop ${TEMP2}
StrCpy ${DOWNLOAD_JRE_FLAG} "NoDownload"
!insertmacro MUI_INSTALLOPTIONS_WRITE "jre.ini" "UserDefinedSection" "JREPath" ${TEMP2}
Return
ExitInstall:
Quit
FunctionEnd
Mainly under NoDownloadJRE: ...not sure though, because it is correctly going thru the DetectJRE call..
JediKnight2
19th December 2006 20:55 UTC
OK...I think I am making SOME headway...If I set the NoDownloadJRE: to mimick the NoFound or FoundOld it works, so that means that the CORRECT answer is given to the install that the install doesn't need a JRE install..problem is in the NoDownloadJRE: part which is
NoDownloadJRE:
Pop ${TEMP}
StrCpy ${DOWNLOAD_JRE_FLAG} "NoDownload"
!insertmacro MUI_INSTALLOPTIONS_WRITE "jre.ini" "UserDefinedSection" "JREPath" ${TEMP2}
Return
I need it to say something like, JRE Is installed click next to continue program install instead of going to the JRE install...