3 ; Definitions for Java Detection
5 !define JRE_VERSION "1.6"
6 !define JRE32_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=52247&/jre-6u27-windows-i586.exe"
7 !define JRE64_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=52249&/jre-6u27-windows-x64.exe"
14 StrCpy $JavaDownload ${JRE64_URL}
17 StrCpy $JavaDownload ${JRE32_URL}
21 MessageBox MB_OK "This product uses Java ${JRE_VERSION}, \
22 $JavaBits bits, it will now \
23 be downloaded and installed"
25 StrCpy $2 "$TEMP\Java Runtime Environment.exe"
26 nsisdl::download /TIMEOUT=30000 $JavaDownload $2
27 Pop $R0 ;Get the return value
28 StrCmp $R0 "success" +3
29 MessageBox MB_OK "Download failed: $R0"
37 DetailPrint "Desired Java version ${JRE_VERSION}"
39 ; Check in HKCU for CurrentVersion
42 ReadRegStr $2 HKCU "SOFTWARE\JavaSoft\Java Runtime Environment" \
45 IfErrors hkcuwow_version
47 DetailPrint "HKEY_CURRENT_USER Java version $2"
49 ${VersionCompare} $2 ${JRE_VERSION} $3
51 IntCmp $3 1 yes yes no
55 ; Check in HKCU Wow6432Node for CurrentVersion
58 ReadRegStr $2 HKCU "SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" \
63 DetailPrint "HKEY_CURRENT_USER Wow6432Node Java version $2"
65 ${VersionCompare} $2 ${JRE_VERSION} $3
67 IntCmp $3 1 yes yes no
71 ; Check in HKLM for CurrentVersion
74 ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \
77 IfErrors hklmwow_version
79 DetailPrint "HKEY_LOCAL_MACHINE Java version $2"
81 ${VersionCompare} $2 ${JRE_VERSION} $3
83 IntCmp $3 1 yes yes no
87 ; Check in HKLM Wow6432Node for CurrentVersion
90 ReadRegStr $2 HKLM "SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment" \
95 DetailPrint "HKEY_LOCAL_MACHINE Wow6432Node Java version $2"
97 ${VersionCompare} $2 ${JRE_VERSION} $3
99 IntCmp $3 1 yes yes no
103 ; Check in HKCU for any Java install
108 EnumRegKey $1 HKCU "SOFTWARE\JavaSoft" $0
110 StrCmp $1 "Java Runtime Environment" found_hkcu
112 StrCmp $1 "" hklm_any
120 DetailPrint "HKEY_CURRENT_USER has SOFTWARE\JavaSoft\$1"
126 ; Check in HKCU for any Java install
131 EnumRegKey $1 HKLM "SOFTWARE\JavaSoft" $0
133 StrCmp $1 "Java Runtime Environment" found_hklm
143 DetailPrint "HKEY_CURRENT_USER has SOFTWARE\JavaSoft\$1"
175 IntCmp $0 1 ask_maybe ask_no yes
178 StrCpy $0 "No Java detected. Download and install?"
182 StrCpy $0 "Cannot determine installed Java version. Download and install?"
186 MessageBox MB_YESNOCANCEL $0 IDYES do_java IDNO skip_java