Check JRE and install if not there
I have been looking at some similar examples, but a bit unsure on why mine is not working
It compiles ok, but running it on a VM with no Java/Apache Tomcat on = just finishes without installing anything.
What am I missing?
;Header Files
!include "MUI2.nsh"
;Definitions
!define PRODUCT_NAME "Dekho"
!define PRODUCT_VERSION "3.2.1"
!define PRODUCT_PUBLISHER "Esri Australia"
!define PRODUCT_WEB_SITE "http://www.dekho.com.au"
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Working\contrib\images\DekhoIcon.ico"
;Basic Settings
Name ${PRODUCT_NAME}
Caption "NSIS ${PRODUCT_VERSION} Setup"
BrandingText "Extending your reach with Dekho"
OutFile "DekhoSetup_v322.exe"
;Default installation folder
InstallDir "$LOCALAPPDATA\Modern UI Test"
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Working\license\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;Languages
!insertmacro MUI_LANGUAGE "English"
;Installer Sections
Section "JRE" SEC01
Call DetectJRE
SectionEnd
Section "Tomcat 7" SEC02
File "contrib\apache-tomcat-7.0.21.exe"
ExecWait "$INSTDIR\apache-tomcat-7.0.21.exe"
SectionEnd
Section "Dekho WAR" SEC03
File "contrib\321for10\DASM.war"
CopyFiles `$INSTDIR\DASM.war` `c:\DASM.war`
StrCpy $0 "$INSTDIR\DASM.war" ;Path of copy file from
StrCpy $1 "c:\DASM.war" ;Path of copy file to
StrCpy $2 1 ; only 0 or 1, set 0 to overwrite file if it already exists
System::Call 'kernel32::CopyFile(t r0, t r1, b r2) l'
Pop $0 ; pops a bool. if overwrite is off and there is a file then error will be 1
SectionEnd
;Functions
Function DetectJRE
StrCpy $1 "SOFTWARE\JavaSoft\Java Runtime Environment"
StrCpy $2 0
ReadRegStr $2 HKLM "$1" "CurrentVersion"
StrCmp $2 "" DetectTry2
ReadRegStr $5 HKLM "$1\$2" "JavaHome"
StrCmp $5 "" DetectTry2
goto done
DetectTry2:
ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
StrCmp $2 "" NoJava
ReadRegStr $5 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$2" "JavaHome"
StrCmp $5 "" NoJava done
done:
;All done.
MessageBox MB_OK "$2 JRE installed"
NoJava:
;Write the script to install Java here
File "contrib\jre-6u26-windows-x64.exe"
DetailPrint "Starting the JRE installation"
ExecWait "$TEMP\jre-6u26-windows-x64.exe"
FunctionEnd