User Tools

Site Tools


userspace:java-ng

This is an old revision of the document!


Java-NG

Feel free to contact me :)

Tested with Opsi 4.0.4.5
Tested with Windows 7 Enterprise x64/x32, 8 Enterprise x64, 8.1 Pro x64, Server 2003 SP2 x32
Tested with Java 6u10 - 8u5
requiredWinstVersion >= 4.11.3
By Kevin Weis 2014-04-17

Download: All in one - installable opsi package (~ 985 MiB)

For an altanative, you can download only the parts you want to support; see Custom install instuctions
Download: Without setup binary´s - installable opsi package (~ 29 KiB)
Download: Setup binary´s - Java 8 (~ 516 MiB)
Download: Setup binary´s - Java 7 (~ 430 MiB)

Download: my Notepad++ Syntax Highlighting

Tree:
|-- setup_data
|   |-- msi
|   |   |-- jdk1.7.0_55
|   |   |   |-- sha1sum.txt
|   |   |   |-- sj170550.cab
|   |   |   |-- ss170550.cab
|   |   |   |-- st170550.cab
|   |   |   `-- sz170550.cab
|   |   |-- jdk1.8.0_05
|   |   |   |-- jdk1.8.0_05.msi
|   |   |   |-- sha1sum.txt
|   |   |   |-- sj180050.cab
|   |   |   |-- ss180050.cab
|   |   |   |-- st180050.cab
|   |   |   `-- sz180050.cab
|   |   |-- jre1.7.0_55
|   |   |   |-- Data1.cab
|   |   |   |-- jre1.7.0_55.msi
|   |   |   |-- jre1031.MST
|   |   |   `-- sha1sum.txt
|   |   `-- jre1.8.0_05
|   |       |-- Data1.cab
|   |       |-- jre1.8.0_05.msi
|   |       |-- jre1031.MST
|   |       `-- sha1sum.txt
|   |-- jdk-7u55-windows-i586.exe
|   |-- jdk-7u55-windows-x64.exe
|   |-- jdk-8u05-windows-i586.exe
|   |-- jdk-8u05-windows-x64.exe
|   |-- jre-7u55-windows-i586.exe
|   |-- jre-7u55-windows-x64.exe
|   |-- jre-8u05-windows-i586.exe
|   |-- jre-8u05-windows-x64.exe
|   |-- License.txt
|   |-- License.url
|   `-- sha1sum.txt
|-- UnlimitedJCEPolicy
|   |-- JCE_PATCHED
|   |-- local_policy.jar
|   |-- README.txt
|   |-- sha1sum.txt
|   `-- US_export_policy.jar
|-- check_msi-exitcode.ins
|-- check_uninstall.ins
|-- delsub.ins
|-- java.png
|-- setup.ins
|-- sha1sum.txt
|-- Sub_UpdateVariables.ins
`-- uninstall.ins

What is does, and what not

It Does:

  1. Handle install and uninstall of: x64 and x86, JRE of Java 1.6.0.10 until 1.8.0.05, JDK of Java 1.7.0.0 until 1.8.0.05
  2. Installation of Java 7 or Java 8
  3. Add the JCE Patch to every Java installation; see: JCE Documentation
  4. Use the check_msi-exitcode script from “Der-Matze”: check_msi-exitcode

It Does NOT:

  1. Uninstall Java versions older then 1.6.0.10, because in update 10 was a new installer dropped which uses an other schema of GUID´s at the Windows Registry
  2. Uninstall Java JDK`s older then 1.7.0.0

Notes

The package includes the MSI installer for the JRE and JDK x86, because if you want to install Java JRE/JDK x86 on a x64 System the EXE installer will “crash” if it was called in a SYSTEM user context. Calling it by hand will work and my package is designed to manage both cases.

It “crashes” in a SYSTEM user environment, because the x86 installer of Java would exteact a MSI package on a x86 System into “C:\Windows\System32\config\systemprofile\AppData\LocalLow\Sun\Java” and call a MSI file and will install Java.
But on a x64 System the Java installer want to extract the MSI package into the same directory. At this point Windows (x64) redirect the request to “C:\Windows\SysWOW64\config\systemprofile\AppData\LocalLow\Sun\Java”. The x86 Java installer does NOT notice the important redirect and still try to call the MSI file and explode with a, File not found, exeption.

There is no error-reporting or handling by the Java (EXE) installer done, but msiexec.exe does report an 1619 (PACKAGE_OPEN_FAILED) exitcode.

This happends only on x64 System`s. My package will ever prefer of using the EXE installer, the MSI files were only called in a fallback case!

Custom install instuctions

If you want to support Java 8 or Java 7, but not both of them, you can download the installable opsi package without setup binary´s, install the package and then download an extract the setup binary´s into “%ScriptPath%\setup_data\”.

Change Log

java (1.8.0.05.13-4.1) urgency=high
  -- Kevin Weis <kevin.weis@faw.de> 2014-04-17
  * update
  * add JRE and JDK of Java 7 (ProductProperty "Version")
  * add discriptions to all ProductPropertys
  * change default of ProductProperty "VM-Type" from "jdk" to "jre" (if winst script is called by hand "jdk" is the default)
  * change default of ProductProperty "WebJava-Security_Level" from "M" to "VH"
  * NOTE: I´m using the JCE patch for Java 8, this work for Java 7 too (tested, no unwanted behaviour with SHA384, SHA512 and AES192, AES256)
  Minor changes:
    * Apply new variables nomination
    * Fix check for minnimum Microsoft Windows Version (Java 8 is not supported on Windows XP, minnimum is Windows Vista >= 6.0)
    * If some fatal error occours, the error will now be displayed (as a Message), too.
    * clean up check_msi-exitcode; remove dead code and display fatal errors.
    * automate get last version of Java 7 and 8 (StringList)

For those people which are intrested in a diff file: java_1.8.0-3.1.diff

TODO

  1. Add support for in-/de-installation of JavaFX

control

control.txt
[Package]
version: 4.1
depends: 
incremental: False
 
[Product]
type: localboot
id: java
name: Java
description: 
advice: 
version: 1.8.0.05.13
priority: -95
licenseRequired: False
productClasses: 
setupScript: setup.ins
uninstallScript: uninstall.ins
updateScript: 
alwaysScript: 
onceScript: 
customScript: 
userLoginScript: 
 
[ProductProperty]
type: unicode
name: version
multivalue: False
editable: False
description: Install Java 7 or 8.
values: ["7", "8"]
default: ["8"]
 
[ProductProperty]
type: unicode
name: vm-type
multivalue: False
editable: False
description: Install the Development Kit (JDK) or just the Java Runtime (JRE)
values: ["jdk", "jre"]
default: ["jre"]
 
[ProductProperty]
type: unicode
name: webjava
multivalue: False
editable: False
description: Install Webplugins.
values: ["Off", "On"]
default: ["On"]
 
[ProductProperty]
type: unicode
name: webjava-security_level
multivalue: False
editable: False
description: Set default security level, for remote execution of Java content.
values: ["H", "M", "VH"]
default: ["VH"]
 
[ProductProperty]
type: unicode
name: java-updater
multivalue: False
editable: False
description: Toggle the Java-Updater and Update-Notifications
values: ["Off", "On"]
default: ["Off"]
 
[Changelog]
java (1.8.0.05.13-4.1) urgency=high
  -- Kevin Weis <kevin.weis@faw.de> 2014-04-17
  * update
  * add JRE and JDK of Java 7 (ProductProperty "Version")
  * add discriptions to all ProductPropertys
  * change default of ProductProperty "VM-Type" from "jdk" to "jre" (if winst script is called by hand "jdk" is the default)
  * change default of ProductProperty "WebJava-Security_Level" from "M" to "VH"
  * NOTE: I´m using the JCE patch for Java 8, this work for Java 7 too (tested, no unwanted behaviour with SHA384, SHA512 and AES192, AES256)
  Minor changes:
    * Apply new variables nomination
    * Fix check for minnimum Microsoft Windows Version (Java 8 is not supported on Windows XP, minnimum is Windows Vista >= 6.0)
    * If some fatal error occours, the error will now be displayed (as a Message), too.
    * clean up check_msi-exitcode; remove dead code and display fatal errors.
    * automate get last version of Java 7 and 8 (StringList)
 
 
java (1.8.0-4) urgency=high
  -- Kevin Weis <kevin.weis@faw.de> 2014-03-25.1933
  * update
  * switch install procedure to exe, insted deprecated use of the msi-package
  * drop install procedure using the msi-package
  * add support for in- and uninstall both (jdk and jre), jce patched of cause ;)
  * switch message locale from german to english
  * Use the check_msi-exitcode script from “Der-Matze”: https://forum.opsi.org/wiki/userspace:check_msi-exitcode
 
see also: http://www.oracle.com/technetwork/java/javase/8train-relnotes-latest-2153846.html
 
 
java (7.0.51-3) urgency=high
  -- Kevin Weis <kevin.weis@faw.de> 2014-01-17.1220
  * update
  * add patch for JCE (Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7)
  * find installed versions of JRE now by using a for loop (supporting deinstallation since java 6u10 x64 and x32)
  * serval other little impovments
 
 
java (7.0.40-2.2) urgency=high
 -- Kevin Weis <kevin.weis@faw.de> 2013-10-14.1009
        update java version to 7.0.40
        SetLogLevel=4
        check_uninstall.ins:
                add explicit declaration for >=java-7.0.10 of "GetRegistryStringValue32" and "GetRegistryStringValue64"
 
 
java (7.0.25-2.1) urgency=high
 -- Kevin Weis <kevin.weis@faw.de> 13:39 02.04.2013
        * check_uninstall.ins:4-9
 
 
java (7.0.17-2.1) urgency=high
 -- Kevin Weis <kevin.weis@faw.de> 13:39 02.04.2013
        - Bugfix bugfix = hing fest bei der Installation/Deinstallation
 
 
java (7.0.9-2.0) urgency=high
 -- Kevin Weis <kevin.weis@faw.de> 12:19 12.11.2012
        - Umstellung auf MSI
        - Automatische Entscheidung zwischen x86 und x64
        - autoupdate = off
        - Bugfix = hing fest bei der Installation/Deinstallation
 
 
java (7.0-7) testing; urgency=low
 
 
java (7.0-4) testing; urgency=low
 -- Kevin Weis <kevinweis@gmx.de> 12:39 05.11.2012
  * Initial package

check_msi-exitcode.ins

check_msi-exitcode.ins
SetLogLevel = 2
 
For $x$ In $StringList_Java6$ Do Sub_Uninstall_6
For $x$ In $StringList_Java7$ Do Sub_Uninstall_7
For $x$ In $StringList_Java8$ Do Sub_Uninstall_8
 
SetLogLevel = $DefaultLogLevel$
 
; Reset changed variables
Sub "%ScriptPath%\Sub_UpdateVariables.ins"
 
[Sub_Uninstall_6]
Message "Search Java 6.0.$x$ x32"
If $ProcessorArchitecture$ = "x86 System"
	If ( "$x$" > "24" )
		Set $Temp_MsiSuffix$ = "FF"
	Else
		Set $Temp_MsiSuffix$ = "F0"
	EndIf
 
	Set $ProductDisplayName$ = GetRegistryStringValue ( "[" + $RegistryPath$ + "{26A24AE4-039D-4CA4-87B4-2F832160" + "$x$" + $Temp_MsiSuffix$ + "}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{26A24AE4-039D-4CA4-87B4-2F832160" + "$x$" + $Temp_MsiSuffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
If $ProcessorArchitecture$ = "64 Bit System"
	If ( "$x$" > "23" )
		Set $Temp_MsiSuffix$ = "FF"
	Else
		Set $Temp_MsiSuffix$ = "F0"
	EndIf
 
	Set $ProductDisplayName$ = GetRegistryStringValue32 ( "[" + $RegistryPath_x64$ + "{26A24AE4-039D-4CA4-87B4-2F832160" + "$x$" + $Temp_MsiSuffix$ + "}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{26A24AE4-039D-4CA4-87B4-2F832160" + "$x$" + $Temp_MsiSuffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
 
	If ( "$x$" > "24" )
		Set $Temp_MsiSuffix$ = "FF"
	Else
		Set $Temp_MsiSuffix$ = "F0"
	EndIf
 
	Message "Search Java 6.0.$x$ x64"
	Set $ProductDisplayName$ = GetRegistryStringValue64 ( "[" + $RegistryPath$ + "{26A24AE4-039D-4CA4-87B4-2F864160" + "$x$" + $Temp_MsiSuffix$ + "}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{26A24AE4-039D-4CA4-87B4-2F864160" + "$x$" + $Temp_MsiSuffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
 
 
 
[Sub_Uninstall_7]
 
If ( "$x$" > "23" )
	Set $Temp_MsiSuffix$ = "FF"
Else
	Set $Temp_MsiSuffix$ = "F0"
EndIf
 
 
Message "Search Java JDK 7.0.$x$ x32"
If $ProcessorArchitecture$ = "x86 System"
	Set $ProductDisplayName$ = GetRegistryStringValue ( "[" + $RegistryPath$ + "{32A3A4F4-B792-11D6-A78A-00B0D0170$x$0}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{32A3A4F4-B792-11D6-A78A-00B0D0170$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
If $ProcessorArchitecture$ = "64 Bit System"
	Set $ProductDisplayName$ = GetRegistryStringValue32 ( "[" + $RegistryPath_x64$ + "{32A3A4F4-B792-11D6-A78A-00B0D0170$x$0}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{32A3A4F4-B792-11D6-A78A-00B0D0170$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
 
	Message "Search Java JDK 7.0.$x$ x64"
	Set $ProductDisplayName$ = GetRegistryStringValue64 ( "[" + $RegistryPath$ + "{64A3A4F4-B792-11D6-A78A-00B0D0170$x$0}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{64A3A4F4-B792-11D6-A78A-00B0D0170$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
 
Message "Search Java JRE 7.0.$x$ x32"
If $ProcessorArchitecture$ = "x86 System"
	Set $ProductDisplayName$ = GetRegistryStringValue ( "[" + $RegistryPath$ + "{26A24AE4-039D-4CA4-87B4-2F832170" + "$x$" + $Temp_MsiSuffix$ + "}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{26A24AE4-039D-4CA4-87B4-2F832170" + "$x$" + $Temp_MsiSuffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
If $ProcessorArchitecture$ = "64 Bit System"
	Set $ProductDisplayName$ = GetRegistryStringValue32 ( "[" + $RegistryPath_x64$ + "{26A24AE4-039D-4CA4-87B4-2F832170" + "$x$" + $Temp_MsiSuffix$ + "}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{26A24AE4-039D-4CA4-87B4-2F832170" + "$x$" + $Temp_MsiSuffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
 
	Message "Search Java 7.0.$x$ x64"
	Set $ProductDisplayName$ = GetRegistryStringValue64 ( "[" + $RegistryPath$ + "{26A24AE4-039D-4CA4-87B4-2F864170" + "$x$" + $Temp_MsiSuffix$ + "}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{26A24AE4-039D-4CA4-87B4-2F864170" + "$x$" + $Temp_MsiSuffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
 
 
 
[Sub_Uninstall_8]
 
; TODO check on every update
If ( "$x$" >= "00" )
	Set $Temp_MsiSuffix$ = "FF"
Else
	Set $Temp_MsiSuffix$ = "F0"
EndIf
 
Message "Search Java JDK 8.0.$x$ x32"
If $ProcessorArchitecture$ = "x86 System"
	Set $ProductDisplayName$ = GetRegistryStringValue ( "[" + $RegistryPath$ + "{32A3A4F4-B792-11D6-A78A-00B0D0180$x$0}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{32A3A4F4-B792-11D6-A78A-00B0D0180$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
If $ProcessorArchitecture$ = "64 Bit System"
	Set $ProductDisplayName$ = GetRegistryStringValue32 ( "[" + $RegistryPath_x64$ +  "{32A3A4F4-B792-11D6-A78A-00B0D0180$x$0}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{32A3A4F4-B792-11D6-A78A-00B0D0180$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
 
	Message "Search Java JDK 8.0.$x$ x64"
	Set $ProductDisplayName$ = GetRegistryStringValue64 ( "[" + $RegistryPath$ + "{64A3A4F4-B792-11D6-A78A-00B0D0180$x$0}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{64A3A4F4-B792-11D6-A78A-00B0D0180$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
 
Message "Search Java JRE 8.0.$x$ x32"
If $ProcessorArchitecture$ = "x86 System"
	Set $ProductDisplayName$ = GetRegistryStringValue ( "[" + $RegistryPath$ + "{26A24AE4-039D-4CA4-87B4-2F832180" + "$x$" + $Temp_MsiSuffix$ + "}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
			Message "Uninstall " + $ProductDisplayName$ + "..."
			Set $Temp_Msi$ = "{26A24AE4-039D-4CA4-87B4-2F832180" + "$x$" + $Temp_MsiSuffix$ + "}"
			Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
If $ProcessorArchitecture$ = "64 Bit System"
	Set $ProductDisplayName$ = GetRegistryStringValue32 ( "[" + $RegistryPath_x64$ + "{26A24AE4-039D-4CA4-87B4-2F832180" + "$x$" + $Temp_MsiSuffix$ + "}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{26A24AE4-039D-4CA4-87B4-2F832180" + "$x$" + $Temp_MsiSuffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
 
	Message "Search Java JRE 8.0.$x$ x64"
	Set $ProductDisplayName$ = GetRegistryStringValue64 ( "[" + $RegistryPath$ + "{26A24AE4-039D-4CA4-87B4-2F864180" + "$x$" + $Temp_MsiSuffix$ + "}] DisplayName" )
	If Not ( $ProductDisplayName$ = "" )
		Message "Uninstall " + $ProductDisplayName$ + "..."
		Set $Temp_Msi$ = "{26A24AE4-039D-4CA4-87B4-2F864180" + "$x$" + $Temp_MsiSuffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf

delsub.ins

delsub.ins
Set $UninstallCommand$ = 'msiexec.exe /X ' + $Temp_Msi$ + ' /qb! REBOOT=ReallySuppress'
 
KillTask "firefox.exe"
KillTask "iexplore.exe"
KillTask "chrome.exe"
KillTask "jqs.exe"
KillTask "java.exe"
KillTask "javaw.exe"
 
SetLogLevel = 6
Message "Uninstall " + $ProductDisplayName$
WinBatch_Uninstall /TimeOutSeconds 120
SetLogLevel = 1
Sub "%ScriptPath%\check_msi-exitcode.ins"
SetLogLevel = 1
 
Message "Uninstall " + $ProductName$ + " done"
 
[WinBatch_Uninstall]
$UninstallCommand$

setup.ins

setup.ins
[Initial]
SetLogLevel = 5
ExitOnError = True
ScriptErrorMessages = Off
TraceMode = Off
StayOnTop = False
 
[Actions]
RequiredWinstVersion >= "4.11.3"
Message "Prepare..."
DefStringList $StringList_Java6$
DefStringList $StringList_Java7$
DefStringList $StringList_Java8$
DefVar $Argument_Msi_AutoUpdateCheck$
DefVar $Argument_Msi_IExplorer$
DefVar $Argument_Msi_Ju$
DefVar $Argument_Msi_Mozilla$
DefVar $Argument_Msi_SysTray$
DefVar $Arguments_Exe$
DefVar $Arguments_Msi$
DefVar $DefaultLogLevel$
DefVar $IsUninstall$
DefVar $MicrosoftWindowsVersion$
DefVar $MinimumSpace$
DefVar $PathSetup_Data$
DefVar $PathSetup_Exe32$
DefVar $PathSetup_Exe64$
DefVar $PathSetup_Msi32$
DefVar $ProcessorArchitecture$
DefVar $ProductDisplayName$
DefVar $ProductDisplayVersion$
DefVar $ProductDisplayVersion_x32$
DefVar $ProductDisplayVersion_x64$
DefVar $ProductName$
DefVar $ProductProperty_Java-Updater$
DefVar $ProductProperty_Version$
DefVar $ProductProperty_VM-Type$
DefVar $ProductProperty_WebJava$
DefVar $ProductProperty_WebJava-Security_Level$
DefVar $ProductVersion$
DefVar $RegistryPath$
DefVar $RegistryPath_x64$
DefVar $Temp_ExitCode$
DefVar $Temp_Message$
DefVar $Temp_MicrosoftWindowsVersionRequired$
DefVar $Temp_MicrosoftWindowsVersionRequiredName$
DefVar $Temp_Msi$
DefVar $Temp_MsiSuffix$
DefVar $UninstallCommand$
DefVar $UpdateVersion7$
DefVar $UpdateVersion8$
 
Set $ProductName$ = "Java"
 
; https://en.wikipedia.org/wiki/Java_version_history#Java_6_updates
Set $StringList_Java6$ = CreateStringList ( '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '43', '45', '51', '65', '71' )
 
; https://en.wikipedia.org/wiki/Java_version_history#Java_7_updates
Set $StringList_Java7$ = CreateStringList ( '00', '01', '02', '03', '04', '05', '06', '07', '09', '10', '11', '13', '15', '17', '21', '25', '40', '45', '51', '55' )
 
; https://en.wikipedia.org/wiki/Java_version_history#Java_8_updates
Set $StringList_Java8$ = CreateStringList ( '00', '05' )
 
; Get last update version
Set $UpdateVersion7$ = TakeString ( -1, $StringList_Java7$ )
Set $UpdateVersion8$ = TakeString ( -1, $StringList_Java8$ )
 
Set $DefaultLogLevel$						= "5"
Set $IsUninstall$							= "False"
Set $MicrosoftWindowsVersion$				= GetMsVersionInfo
Set $MinimumSpace$						= "248 MB"
Set $PathSetup_Data$						= "%ScriptPath%\setup_data\"
Set $ProcessorArchitecture$					= GetSystemType
Set $ProductProperty_Java-Updater$				= GetProductProperty ( "Java-Updater"			, "Off"	)
Set $ProductProperty_VM-Type$				= GetProductProperty ( "VM-Type"					, "jdk"	)
Set $ProductProperty_Version$				= GetProductProperty ( "Version"					, "8"	)
Set $ProductProperty_WebJava$				= GetProductProperty ( "WebJava"					, "On"	)
Set $ProductProperty_WebJava-Security_Level$	= GetProductProperty ( "WebJava-Security_Level"	, "VH"	)
Set $RegistryPath$							= "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set $RegistryPath_x64$						= "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
Set $Temp_MsiSuffix$						= ""
 
; Reset changed variables
Sub "%ScriptPath%\Sub_UpdateVariables.ins"
 
; Parse selected ProductPropertys and generate installation argument list
If $ProductProperty_WebJava$ = "On"
	Set $ProductProperty_WebJava$ = "WEB_JAVA=1"
	Set $Argument_Msi_IExplorer$ = "IEXPLORER=1"
	Set $Argument_Msi_Mozilla$ = "MOZILLA=1"
Else
	Set $ProductProperty_WebJava$ = "WEB_JAVA=0"
	Set $Argument_Msi_IExplorer$ = "IEXPLORER=0"
	Set $Argument_Msi_Mozilla$ = "MOZILLA=0"
EndIf
 
If $ProductProperty_WebJava-Security_Level$ = "M"
	Set $ProductProperty_WebJava-Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=M"
EndIf
If $ProductProperty_WebJava-Security_Level$ = "H"
	Set $ProductProperty_WebJava-Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=H"
EndIf
If $ProductProperty_WebJava-Security_Level$ = "VH"
	Set $ProductProperty_WebJava-Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=VH"
EndIf
 
If $ProductProperty_Java-Updater$ = "On"
	Set $Argument_Msi_SysTray$ = "SYSTRAY=1"
	Set $ProductProperty_Java-Updater$ = "JAVAUPDATE=1"
	Set $Argument_Msi_Ju$ = "JU=1"
	Set $Argument_Msi_AutoUpdateCheck$ = "AUTOUPDATECHECK=1"
Else
	Set $Argument_Msi_SysTray$ = "SYSTRAY=0"
	Set $ProductProperty_Java-Updater$ = "JAVAUPDATE=0"
	Set $Argument_Msi_Ju$ = "JU=0"
	Set $Argument_Msi_AutoUpdateCheck$ = "AUTOUPDATECHECK=0"
EndIf
 
Set $Arguments_Exe$ = "/s " + $ProductProperty_WebJava$ + " " + $ProductProperty_WebJava-Security_Level$ + " STATIC=0"
Set $Arguments_Msi$ = "/qb! REBOOT=ReallySuppess " + $Argument_Msi_IExplorer$ + " " + $Argument_Msi_Mozilla$ + " " + $Argument_Msi_SysTray$ + " " + $ProductProperty_Java-Updater$ + " " + $Argument_Msi_Ju$ + " " + $Argument_Msi_AutoUpdateCheck$
 
ShowBitMap /3 "%ScriptPath%\java.png" $ProductName$
SetLogLevel = $DefaultLogLevel$
 
If $ProductProperty_Version$ = "7"
	Set $Temp_MicrosoftWindowsVersionRequired$ = "5.1"
	Set $Temp_MicrosoftWindowsVersionRequiredName$ = "XP"
Else
	Set $Temp_MicrosoftWindowsVersionRequired$ = "6.0"
	Set $Temp_MicrosoftWindowsVersionRequiredName$ = "Vista"
EndIf
If $MicrosoftWindowsVersion$ < $Temp_MicrosoftWindowsVersionRequired$
	Message "Fatal error: Minimum Windows " + $Temp_MicrosoftWindowsVersionRequiredName$ + " is required for " + $ProductName$ + " " + $ProductProperty_Version$
	LogError "Minimum Windows " + $Temp_MicrosoftWindowsVersionRequiredName$ + " is required for " + $ProductName$ + " " + $ProductProperty_Version$
	IsFatalError "Minimum Windows " + $Temp_MicrosoftWindowsVersionRequiredName$ + " is required For " + $ProductName$ + " " + $ProductProperty_Version$
EndIf
 
If Not ( HasMinimumSpace ( "%SystemDrive%", $MinimumSpace$ ) )
	Message "Fatal error: Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductName$
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductName$
	IsFatalError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed For " + $ProductName$
EndIf
 
Sub "%ScriptPath%\check_uninstall.ins"
 
KillTask "firefox.exe"
KillTask "iexplore.exe"
KillTask "chrome.exe"
KillTask "jqs.exe"
KillTask "java.exe"
KillTask "javaw.exe"
 
; #############################################################################################################################################
; ################################################################### Install x64 ###################################################################
; #############################################################################################################################################
 
If $ProcessorArchitecture$ = "64 Bit System"
        Message "Install " + $ProductDisplayVersion_x64$
		If FileExists ( $PathSetup_Data$ + $PathSetup_Exe64$ )
			SetLogLevel = 6
			WinBatch_install_x64 /WaitOnClose
			SetLogLevel = 1
			Sub "%ScriptPath%\check_msi-exitcode.ins"
		Else
			Message "Fatal error: File not found: " + $PathSetup_Data$ + $PathSetup_Exe64$
			LogError "File not found: " + $PathSetup_Data$ + $PathSetup_Exe64$
			IsFatalError "File not found: " + $exePath$ + $exe_64$
		EndIf
 
		If $ProductProperty_Java-Updater$ = "JAVAUPDATE=0"
			Registry_disable_update /64Bit
		EndIf
 
		Message "Install " + $ProductDisplayVersion_x32$ + " first try"
		If FileExists ( $PathSetup_Data$ + $PathSetup_Exe32$ )
			SetLogLevel = 6
			WinBatch_install_x86 /WaitOnClose
			SetLogLevel = 1
			Sub "%ScriptPath%\check_msi-exitcode.ins"
		Else
			LogWarning "File not found: " + $exePath$ + $exe_32$
		EndIf
 
		; Installation of Java x86 at a x64 system envirement does "fail", because the java x86 installer seems NOT to be designed to be executed In a SYSTEM "user" conetxt.
		Set $Temp_ExitCode$ = GetLastExitCode
		If $Temp_ExitCode$ = "1619"
			Comment "ExitCode = " + $Temp_ExitCode$ + ' ERROR_INSTALL_PACKAGE_OPEN_FAILED; This is what we expected, so its a "good" sign.'
			SetLogLevel = 5
			Files_delete_broken_x86_x64 /32Bit
			SetLogLevel = 1
			Sub "%ScriptPath%\check_msi-exitcode.ins"
 
			Message "Install " + $ProductDisplayVersion_x32$ + " second try"
			If $ProductProperty_VM-Type$ = "jdk"
				If FileExists ( $PathSetup_Data$ + $PathSetup_Msi32$ )
					SetLogLevel = 6
					WinBatch_install_x86_64_UseMSI /WaitOnClose
					SetLogLevel = 1
					Sub "%ScriptPath%\check_msi-exitcode.ins"
				Else
					Message "Fatal error: File not found: " + $PathSetup_Data$ + $PathSetup_Msi32$
					LogError "File not found: " + $PathSetup_Data$ + $PathSetup_Msi32$
					IsFatalError "File not found: " + $exePath$ + $msi32$
				EndIf
			EndIf
 
			; Explicit install Java x86, because in this situation the Java Installer (MSI) only install the jdk And for some reason it does NOT install the jre :(
			Set $PathSetup_Msi32$ = "msi\jre" + $ProductVersion$ + "\jre" + $ProductVersion$ + ".msi"
			If FileExists ( $PathSetup_Data$ + $PathSetup_Msi32$ )
				SetLogLevel = 6
				WinBatch_install_x86_64_UseMSI /WaitOnClose
				SetLogLevel = 1
				Sub "%ScriptPath%\check_msi-exitcode.ins"
			Else
				Message "Fatal error: File not found: " + $PathSetup_Data$ + $PathSetup_Msi32$
				LogError "File not found: " + $PathSetup_Data$ + $PathSetup_Msi32$
				IsFatalError "File not found: " + $PathSetup_Data$ + $PathSetup_Msi32$
			EndIf
 
			; Reset changed variables
			Sub "%ScriptPath%\Sub_UpdateVariables.ins"
		Else
			Sub "%ScriptPath%\check_msi-exitcode.ins"
		EndIf
		If $ProductProperty_Java-Updater$ = "JAVAUPDATE=0"
			Registry_disable_update /32Bit
		EndIf
EndIf
 
; #############################################################################################################################################
; ################################################################### Install x32 ###################################################################
; #############################################################################################################################################
 
If $ProcessorArchitecture$ = "x86 System"
        Message "Install " + $ProductDisplayVersion_x32$
		If FileExists ( $PathSetup_Data$ + $PathSetup_Exe32$ )
			SetLogLevel = 6
			WinBatch_install_x86 /WaitOnClose
			SetLogLevel = 1
			Sub "%ScriptPath%\check_msi-exitcode.ins"
		Else
			Message "Fatal error: File not found: " + $PathSetup_Data$ + $PathSetup_Exe32$
			LogError "File not found: " + $PathSetup_Data$ + $PathSetup_Exe32$
			IsFatalError "File not found: " + $PathSetup_Data$ + $PathSetup_Exe32$
		EndIf
		If $ProductProperty_Java-Updater$ = "JAVAUPDATE=0"
			Registry_disable_update /32Bit
		EndIf
EndIf
 
; Patch JCE
If $ProcessorArchitecture$ = "64 Bit System"
	If FileExists ( "%ProgramFiles64Dir%\Java\jre" + $ProductProperty_Version$ + "\bin\java.exe" )
		Message "Apply patch For JCE (Java Cryptography Extension)"
		If $ProductProperty_VM-Type$ = "jdk" And FileExists ( "%ProgramFiles64Dir%\Java\jdk" + $ProductVersion$ + "\bin\javac.exe" )
			Files_patch_JCE_JDK_x64
		EndIf
		If $ProductProperty_VM-Type$ = "jdk" And ( Not ( FileExists ( "%ProgramFiles64Dir%\Java\jdk" + $ProductVersion$ + "\bin\javac.exe" ) ) )
			LogWarning "NOT Patching JCE for x64 JDK; File not found: %ProgramFiles64Dir%\Java\jdk" + $ProductVersion$ + "\bin\javac.exe"
		EndIf
		Files_patch_JCE_JRE_x64
	Else
		LogWarning "NOT Patching JCE for x64 JRE and JDK; File not found: %ProgramFiles64Dir%\Java\jre" + $ProductProperty_Version$ + "\bin\java.exe"
	EndIf
EndIf
 
If FileExists ( "%ProgramFiles32Dir%\Java\jre" + $ProductProperty_Version$ + "\bin\java.exe" )
	Message "Apply patch For JCE (Java Cryptography Extension)"
	If $ProductProperty_VM-Type$ = "jdk" And FileExists ( "%ProgramFiles32Dir%\Java\jdk" + $ProductVersion$ + "\bin\javac.exe" )
		Files_patch_JCE_JDK_x86
	EndIf
	If $ProductProperty_VM-Type$ = "jdk" And ( Not ( FileExists ( "%ProgramFiles32Dir%\Java\jdk" + $ProductVersion$ + "\bin\javac.exe" ) ) )
		LogWarning "NOT Patching JCE for x86 JDK; File not found: %ProgramFiles32Dir%\Java\jdk" + $ProductVersion$ + "\bin\javac.exe"
	EndIf
	Files_patch_JCE_JRE_x86
Else
	LogWarning "NOT Patching JCE for x86 JRE and JDK; File not found: %ProgramFiles32Dir%\Java\jre" + $ProductProperty_Version$ + "\bin\java.exe"
EndIf
 
Message "Install complete"
 
 
[WinBatch_install_x86_64_UseMSI]
msiexec /i "$PathSetup_Data$$PathSetup_Msi32$" $Arguments_Msi$
 
[WinBatch_install_x86]
"$PathSetup_Data$$PathSetup_Exe32$" $Arguments_Exe$
 
[WinBatch_install_x64]
"$PathSetup_Data$$PathSetup_Exe64$" $Arguments_Exe$
 
[Files_delete_broken_x86_x64]
Delete -f -s "%ProgramFiles32Dir%\Java"
 
[Registry_disable_update]
OpenKey [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Update\Policy]
Set "EnableJavaUpdate"=REG_DWORD:0
 
[Files_patch_JCE_JDK_x86]
Copy -s "%ScriptPath%\UnlimitedJCEPolicy\*.*" "%ProgramFiles32Dir%\Java\jdk$ProductVersion$\jre\lib\security"
 
[Files_patch_JCE_JDK_x64]
Copy -s "%ScriptPath%\UnlimitedJCEPolicy\*.*" "%ProgramFiles64Dir%\Java\jdk$ProductVersion$\jre\lib\security"
 
[Files_patch_JCE_JRE_x86]
Copy -s "%ScriptPath%\UnlimitedJCEPolicy\*.*" "%ProgramFiles32Dir%\Java\jre$ProductProperty_Version$\lib\security"
 
[Files_patch_JCE_JRE_x64]
Copy -s "%ScriptPath%\UnlimitedJCEPolicy\*.*" "%ProgramFiles64Dir%\Java\jre$ProductProperty_Version$\lib\security"

Sub_UpdateVariables.ins

Sub_UpdateVariables.ins
If $ProductProperty_Version$ = "8"
	Set $ProductDisplayVersion$				= $ProductProperty_Version$ + "u" + $UpdateVersion8$
	Set $ProductVersion$					= "1." + $ProductProperty_Version$ + ".0_" + $UpdateVersion8$
EndIf
If $ProductProperty_Version$ = "7"
	Set $ProductDisplayVersion$				= $ProductProperty_Version$ + "u" + $UpdateVersion7$
	Set $ProductVersion$					= "1." + $ProductProperty_Version$ + ".0_" + $UpdateVersion7$
EndIf
 
Set $PathSetup_Msi32$						= "msi\" + $ProductProperty_VM-Type$ + $ProductVersion$ + "\" + $ProductProperty_VM-Type$ + $ProductVersion$ + ".msi"
Set $PathSetup_Exe32$						= $ProductProperty_VM-Type$ + "-" + $ProductDisplayVersion$ + "-windows-i586.exe"
Set $PathSetup_Exe64$						= $ProductProperty_VM-Type$ + "-" + $ProductDisplayVersion$ + "-windows-x64.exe"
Set $ProductDisplayName$					= $ProductName$ + " " + $ProductDisplayVersion$
Set $ProductDisplayVersion_x32$				= $ProductDisplayName$ + " " + $ProductProperty_VM-Type$ + " x32"
Set $ProductDisplayVersion_x64$				= $ProductDisplayName$ + " " + $ProductProperty_VM-Type$ + " x64"

uninstall.ins

uninstall.ins
[Initial]
SetLogLevel = 5
ExitOnError = True
ScriptErrorMessages = Off
TraceMode = Off
StayOnTop = False
 
[Actions]
RequiredWinstVersion >= "4.11.3"
Message "Prepare..."
DefStringList $StringList_Java6$
DefStringList $StringList_Java7$
DefStringList $StringList_Java8$
DefVar $Argument_Msi_AutoUpdateCheck$
DefVar $Argument_Msi_IExplorer$
DefVar $Argument_Msi_Ju$
DefVar $Argument_Msi_Mozilla$
DefVar $Argument_Msi_SysTray$
DefVar $Arguments_Exe$
DefVar $Arguments_Msi$
DefVar $DefaultLogLevel$
DefVar $IsUninstall$
DefVar $MicrosoftWindowsVersion$
DefVar $MinimumSpace$
DefVar $PathSetup_Data$
DefVar $PathSetup_Exe32$
DefVar $PathSetup_Exe64$
DefVar $PathSetup_Msi32$
DefVar $ProcessorArchitecture$
DefVar $ProductDisplayName$
DefVar $ProductDisplayVersion$
DefVar $ProductDisplayVersion_x32$
DefVar $ProductDisplayVersion_x64$
DefVar $ProductName$
DefVar $ProductProperty_Java-Updater$
DefVar $ProductProperty_Version$
DefVar $ProductProperty_VM-Type$
DefVar $ProductProperty_WebJava$
DefVar $ProductProperty_WebJava-Security_Level$
DefVar $ProductVersion$
DefVar $RegistryPath$
DefVar $RegistryPath_x64$
DefVar $Temp_ExitCode$
DefVar $Temp_Message$
DefVar $Temp_MicrosoftWindowsVersionRequired$
DefVar $Temp_Msi$
DefVar $Temp_MsiSuffix$
DefVar $UninstallCommand$
DefVar $UpdateVersion7$
DefVar $UpdateVersion8$
 
Set $ProductName$ = "Java"
 
; https://en.wikipedia.org/wiki/Java_version_history#Java_6_updates
Set $StringList_Java6$ = CreateStringList ( '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '43', '45', '51', '65', '71' )
 
; https://en.wikipedia.org/wiki/Java_version_history#Java_7_updates
Set $StringList_Java7$ = CreateStringList ( '00', '01', '02', '03', '04', '05', '06', '07', '09', '10', '11', '13', '15', '17', '21', '25', '40', '45', '51', '55' )
 
; https://en.wikipedia.org/wiki/Java_version_history#Java_8_updates
Set $StringList_Java8$ = CreateStringList ( '00', '05' )
 
; Get last update version
Set $UpdateVersion7$ = TakeString ( -1, $StringList_Java7$ )
Set $UpdateVersion8$ = TakeString ( -1, $StringList_Java8$ )
 
Set $DefaultLogLevel$						= "5"
Set $IsUninstall$							= "True"
Set $MicrosoftWindowsVersion$				= GetMsVersionInfo
Set $MinimumSpace$						= "248 MB"
Set $PathSetup_Data$						= "%ScriptPath%\setup_data\"
Set $ProcessorArchitecture$					= GetSystemType
Set $ProductProperty_Java-Updater$				= GetProductProperty ( "Java-Updater"			, "Off"	)
Set $ProductProperty_VM-Type$				= GetProductProperty ( "VM-Type"					, "jdk"	)
Set $ProductProperty_Version$				= GetProductProperty ( "Version"					, "8"	)
Set $ProductProperty_WebJava$				= GetProductProperty ( "WebJava"					, "On"	)
Set $ProductProperty_WebJava-Security_Level$	= GetProductProperty ( "WebJava-Security_Level"	, "VH"	)
Set $RegistryPath$							= "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set $RegistryPath_x64$						= "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
Set $Temp_MsiSuffix$						= ""
 
; Reset changed variables
Sub "%ScriptPath%\Sub_UpdateVariables.ins"
 
; Parse selected ProductPropertys and generate installation argument list
If $ProductProperty_WebJava$ = "On"
	Set $ProductProperty_WebJava$ = "WEB_JAVA=1"
	Set $Argument_Msi_IExplorer$ = "IEXPLORER=1"
	Set $Argument_Msi_Mozilla$ = "MOZILLA=1"
Else
	Set $ProductProperty_WebJava$ = "WEB_JAVA=0"
	Set $Argument_Msi_IExplorer$ = "IEXPLORER=0"
	Set $Argument_Msi_Mozilla$ = "MOZILLA=0"
EndIf
 
If $ProductProperty_WebJava-Security_Level$ = "M"
	Set $ProductProperty_WebJava-Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=M"
EndIf
If $ProductProperty_WebJava-Security_Level$ = "H"
	Set $ProductProperty_WebJava-Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=H"
EndIf
If $ProductProperty_WebJava-Security_Level$ = "VH"
	Set $ProductProperty_WebJava-Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=VH"
EndIf
 
If $ProductProperty_Java-Updater$ = "On"
	Set $Argument_Msi_SysTray$ = "SYSTRAY=1"
	Set $ProductProperty_Java-Updater$ = "JAVAUPDATE=1"
	Set $Argument_Msi_Ju$ = "JU=1"
	Set $Argument_Msi_AutoUpdateCheck$ = "AUTOUPDATECHECK=1"
Else
	Set $Argument_Msi_SysTray$ = "SYSTRAY=0"
	Set $ProductProperty_Java-Updater$ = "JAVAUPDATE=0"
	Set $Argument_Msi_Ju$ = "JU=0"
	Set $Argument_Msi_AutoUpdateCheck$ = "AUTOUPDATECHECK=0"
EndIf
 
Set $Arguments_Exe$ = "/s " + $ProductProperty_WebJava$ + " " + $ProductProperty_WebJava-Security_Level$
Set $Arguments_Msi$ = "/qb! REBOOT=ReallySuppess " + $Argument_Msi_IExplorer$ + " " + $Argument_Msi_Mozilla$ + " " + $Argument_Msi_SysTray$ + " " + $ProductProperty_Java-Updater$ + " " + $Argument_Msi_Ju$ + " " + $Argument_Msi_AutoUpdateCheck$
 
ShowBitMap /3 "%ScriptPath%\java.png" $ProductName$
SetLogLevel = $DefaultLogLevel$
 
Sub "%ScriptPath%\check_uninstall.ins"
 
Message "Uninstall complete"
userspace/java-ng.1397731583.txt.gz · Last modified: 2021/08/23 08:37 (external edit)