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
requiredWinstVersion >= 4.11.3
Tested with Windows 7 Enterprise x64/x86, 8 Enterprise x64, 8.1 Pro x64
Tested with Java 6u24 - 8u0
By Kevin Weis 2014-03-28

Download: installable opsi package (~ 538 MiB)

Download: my Notepad++ Syntax Highlighting

Tree:
|-- setup_data
|   |-- msi
|   |   |-- jdk1.8.0
|   |   |   |-- jdk1.8.0.msi
|   |   |   |-- sj180000.cab
|   |   |   |-- ss180000.cab
|   |   |   |-- st180000.cab
|   |   |   `-- sz180000.cab
|   |   `-- jre1.8.0
|   |       |-- Data1.cab
|   |       |-- jre1.8.0.msi
|   |       `-- jre1031.MST
|   |-- jdk-8-windows-i586.exe
|   |-- jdk-8-windows-x64.exe
|   |-- jre-8-windows-i586.exe
|   |-- jre-8-windows-x64.exe
|   |-- License.txt
|   `-- License.url
|-- UnlimitedJCEPolicy
|   |-- JCE_PATCHED
|   |-- local_policy.jar
|   |-- README.txt
|   `-- US_export_policy.jar
|-- check_msi-exitcode.ins
|-- check_uninstall.ins
|-- delsub.ins
|-- java.png
|-- javaFullSize.png
|-- setup.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, JDK of Java 1.7.0.0 until 1.8.0
  2. Add the JCE Patch to every Java installation; see: JCE Documentation
  3. 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!

Change Log

java (1.8.0-3.1) urgency=high
  -- Kevin Weis <kevin.weis@faw.de> 2014-03-28
  * update, to Java 8
  * 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
  * Add ProductPropertys; install_architecture, java-updater, webjava-security_level, webjava and vm-type
  * Use the check_msi-exitcode script from “Der-Matze”: https://forum.opsi.org/wiki/userspace:check_msi-exitcode
  * Automate get the last entry of “$version7$” (“setup.ins”, “uninstall.ins” line: 52)
  * Change product version notation from "7.0.51" to "1.7.0.51"

see also: http://www.oracle.com/technetwork/java/javase/8train-relnotes-latest-2153846.html

For those people which are intrested in a diff file: java-7.0.51-3.diff

check_msi-exitcode.ins

check_msi-exitcode.ins
SetLogLevel = 1
Set $ExitCode$ = GetLastExitCode
 
If ( $ExitCode$ = "0" Or $ExitCode$ ="1641" Or $ExitCode$ ="3010" )
	If ( $ExitCode$ = "0" )
		SetLogLevel = 5
		Comment "ExitCode = " + $ExitCode$ + " Action completed successfully."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1641" )
		SetLogLevel = 5
		Comment "ExitCode = " + $ExitCode$ + " ERROR_SUCCESS_REBOOT_INITIATED The installer has started a reboot. This error code Not available on Windows Installer version 1.0."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "3010" )
		SetLogLevel = 5
		Comment "ExitCode = " + $ExitCode$ + " ERROR_SUCCESS_REBOOT_REQUIRED A reboot is required to complete the install. This does Not include installs where the ForceReboot action is run. This error code Not available on Windows Installer version 1.0."
		SetLogLevel = 1
	EndIf
 
 
Else
 
 
	If ( $ExitCode$ = "13" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_DATA The data is invalid."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_DATA The data is invalid."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "87" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_PARAMETER One of the parameters was invalid."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_PARAMETER One of the parameters was invalid."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "120" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_CALL_NOT_IMPLEMENTED This function is Not available For this platform. It is only available on Windows 2000 And Windows XP with Window Installer version 2.0."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_CALL_NOT_IMPLEMENTED This function is Not available For this platform. It is only available on Windows 2000 And Windows XP with Window Installer version 2.0."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1259" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_APPHELP_BLOCK This error code only occurs when using Windows Installer version 2.0 And Windows XP Or later. If Windows Installer determines a product may be incompatible with the current operating system, it displays a dialog informing the user And asking whether to try to install anyway. This error code is returned If the user chooses Not to try the installation."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_APPHELP_BLOCK This error code only occurs when using Windows Installer version 2.0 And Windows XP Or later. If Windows Installer determines a product may be incompatible with the current operating system, it displays a dialog informing the user And asking whether to try to install anyway. This error code is returned If the user chooses Not to try the installation."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1601" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_SERVICE_FAILURE The Windows Installer service could Not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_SERVICE_FAILURE The Windows Installer service could Not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1602" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_USEREXIT User cancel installation."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_USEREXIT User cancel installation."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1603" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_FAILURE Fatal error during installation."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_FAILURE Fatal error during installation."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1604" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_SUSPEND Installation suspended, incomplete."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_SUSPEND Installation suspended, incomplete."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1605" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_UNKNOWN_PRODUCT This action is only valid For products that are currently installed."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_UNKNOWN_PRODUCT This action is only valid For products that are currently installed."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1606" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_UNKNOWN_FEATURE Feature ID Not registered."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_UNKNOWN_FEATURE Feature ID Not registered."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1607" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_UNKNOWN_COMPONENT Component ID Not registered."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_UNKNOWN_COMPONENT Component ID Not registered."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1608" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_UNKNOWN_PROPERTY Unknown property."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_UNKNOWN_PROPERTY Unknown property."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1609" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_HANDLE_STATE Handle is In an invalid state."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_HANDLE_STATE Handle is In an invalid state."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1610" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_BAD_CONFIGURATION The configuration data For this product is corrupt. Contact your support personnel."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_BAD_CONFIGURATION The configuration data For this product is corrupt. Contact your support personnel."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1611" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INDEX_ABSENT Component qualifier Not present."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INDEX_ABSENT Component qualifier Not present."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1612" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_SOURCE_ABSENT The installation source For this product is Not available. Verify that the source exists And that you can access it."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_SOURCE_ABSENT The installation source For this product is Not available. Verify that the source exists And that you can access it."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1613" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_PACKAGE_VERSION This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_PACKAGE_VERSION This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1614" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_PRODUCT_UNINSTALLED Product is uninstalled."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_PRODUCT_UNINSTALLED Product is uninstalled."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1615" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_BAD_QUERY_SYNTAX SQL query syntax invalid Or unsupported."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_BAD_QUERY_SYNTAX SQL query syntax invalid Or unsupported."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1616" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_FIELD Record field does Not exist."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_FIELD Record field does Not exist."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1618" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_ALREADY_RUNNING Another installation is already In progress. Complete that installation before proceeding with this install."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_ALREADY_RUNNING Another installation is already In progress. Complete that installation before proceeding with this install."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1619" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_PACKAGE_OPEN_FAILED This installation package could Not be opened. Verify that the package exists And that you can access it, Or contact the application vendor to verify that this is a valid Windows Installer package."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_PACKAGE_OPEN_FAILED This installation package could Not be opened. Verify that the package exists And that you can access it, Or contact the application vendor to verify that this is a valid Windows Installer package."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1620" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_PACKAGE_INVALID This installation package could Not be opened. Contact the application vendor to verify that this is a valid Windows Installer package."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_PACKAGE_INVALID This installation package could Not be opened. Contact the application vendor to verify that this is a valid Windows Installer package."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1621" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_UI_FAILURE There was an error starting the Windows Installer service user interface. Contact your support personnel."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_UI_FAILURE There was an error starting the Windows Installer service user interface. Contact your support personnel."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1622" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_LOG_FAILURE Error opening installation log file. Verify that the specified log file location exists And is writable."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_LOG_FAILURE Error opening installation log file. Verify that the specified log file location exists And is writable."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1623" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_LANGUAGE_UNSUPPORTED This language of this installation package is Not supported by your system."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_LANGUAGE_UNSUPPORTED This language of this installation package is Not supported by your system."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1624" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_TRANSFORM_FAILURE Error applying transforms. Verify that the specified transform paths are valid."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_TRANSFORM_FAILURE Error applying transforms. Verify that the specified transform paths are valid."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1625" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_PACKAGE_REJECTED This installation is forbidden by system policy. Contact your system administrator."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_PACKAGE_REJECTED This installation is forbidden by system policy. Contact your system administrator."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1626" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_FUNCTION_NOT_CALLED Function could Not be executed."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_FUNCTION_NOT_CALLED Function could Not be executed."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1627" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_FUNCTION_FAILED Function failed during execution."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_FUNCTION_FAILED Function failed during execution."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1628" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_TABLE Invalid Or unknown table specified."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_TABLE Invalid Or unknown table specified."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1629" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_DATATYPE_MISMATCH Data supplied is of wrong type."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_DATATYPE_MISMATCH Data supplied is of wrong type."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1630" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_UNSUPPORTED_TYPE Data of this type is Not supported."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_UNSUPPORTED_TYPE Data of this type is Not supported."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1631" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_CREATE_FAILED The Windows Installer service failed to start. Contact your support personnel."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_CREATE_FAILED The Windows Installer service failed to start. Contact your support personnel."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1632" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_TEMP_UNWRITABLE The temp folder is either full Or inaccessible. Verify that the temp folder exists And that you can write to it."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_TEMP_UNWRITABLE The temp folder is either full Or inaccessible. Verify that the temp folder exists And that you can write to it."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1633" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_PLATFORM_UNSUPPORTED This installation package is Not supported on this platform. Contact your application vendor."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_PLATFORM_UNSUPPORTED This installation package is Not supported on this platform. Contact your application vendor."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1634" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_NOTUSED Component Not used on this machine"
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_NOTUSED Component Not used on this machine"
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1635" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_PATCH_PACKAGE_OPEN_FAILED This patch package could Not be opened. Verify that the patch package exists And that you can access it, Or contact the application vendor to verify that this is a valid Windows Installer patch package."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_PATCH_PACKAGE_OPEN_FAILED This patch package could Not be opened. Verify that the patch package exists And that you can access it, Or contact the application vendor to verify that this is a valid Windows Installer patch package."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1636" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_PATCH_PACKAGE_INVALID This patch package could Not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_PATCH_PACKAGE_INVALID This patch package could Not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1637" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_PATCH_PACKAGE_UNSUPPORTED This patch package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_PATCH_PACKAGE_UNSUPPORTED This patch package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1638" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_PRODUCT_VERSION Another version of this product is already installed. Installation of this version cannot continue. To configure Or remove the existing version of this product, use Add/Remove Programs on the Control Panel."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_PRODUCT_VERSION Another version of this product is already installed. Installation of this version cannot continue. To configure Or remove the existing version of this product, use Add/Remove Programs on the Control Panel."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1639" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_COMMAND_LINE Invalid command line argument. Consult the Windows Installer SDK For detailed command line help."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INVALID_COMMAND_LINE Invalid command line argument. Consult the Windows Installer SDK For detailed command line help."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1640" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_REMOTE_DISALLOWED Installation from a Terminal Server client session Not permitted For current user."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_REMOTE_DISALLOWED Installation from a Terminal Server client session Not permitted For current user."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1642" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_PATCH_TARGET_NOT_FOUND The installer cannot install the upgrade patch because the program being upgraded may be missing Or the upgrade patch updates a different version of the program. Verify that the program to be upgraded exists on your computer And that you have the correct upgrade patch. This error code is Not available on Windows Installer version 1.0."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_PATCH_TARGET_NOT_FOUND The installer cannot install the upgrade patch because the program being upgraded may be missing Or the upgrade patch updates a different version of the program. Verify that the program to be upgraded exists on your computer And that you have the correct upgrade patch. This error code is Not available on Windows Installer version 1.0."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1643" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_PATCH_PACKAGE_REJECTED The patch package is Not permitted by system policy. This error code is available with Windows Installer versions 2.0 Or later."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_PATCH_PACKAGE_REJECTED The patch package is Not permitted by system policy. This error code is available with Windows Installer versions 2.0 Or later."
		SetLogLevel = 1
	EndIf
 
	If ( $ExitCode$ = "1644" )
		SetLogLevel = 5
		LogError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_TRANSFORM_REJECTED One Or more customizations are Not permitted by system policy. This error code is available with Windows Installer versions 2.0 Or later."
		IsFatalError "ExitCode = " + $ExitCode$ + " ERROR_INSTALL_TRANSFORM_REJECTED One Or more customizations are Not permitted by system policy. This error code is available with Windows Installer versions 2.0 Or later."
		SetLogLevel = 1
	EndIf
EndIf
 
SetLogLevel = $DefaultLogLevel$

check_uninstall.ins

check_uninstall.ins
SetLogLevel = 1
For $x$ In $version6$ Do sub_uninstall_6
For $x$ In $version7$ Do sub_uninstall_7
For $x$ In $version8$ Do sub_uninstall_8
SetLogLevel = $DefaultLogLevel$
 
[Sub_uninstall_6]
Message "Search Java 6.0.$x$ x32"
If $INST_SystemType$ = "x86 System"
	If ( "$x$" > "24" )
		Set $msi_suffix$ = "FF"
	Else
		Set $msi_suffix$ = "F0"
	EndIf
 
	Set $DisplayName$ = GetRegistryStringValue ( "[" + $Path$ + "{26A24AE4-039D-4CA4-87B4-2F832160" + "$x$" + $msi_suffix$ + "}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ = "{26A24AE4-039D-4CA4-87B4-2F832160" + "$x$" + $msi_suffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
If $INST_SystemType$ = "64 Bit System"
	If ( "$x$" > "23" )
		Set $msi_suffix$ = "FF"
	Else
		Set $msi_suffix$ = "F0"
	EndIf
 
	Set $DisplayName$ = GetRegistryStringValue32 ( "[" + $Path_64$ + "{26A24AE4-039D-4CA4-87B4-2F832160" + "$x$" + $msi_suffix$ + "}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ = "{26A24AE4-039D-4CA4-87B4-2F832160" + "$x$" + $msi_suffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
 
	If ( "$x$" > "24" )
		Set $msi_suffix$ = "FF"
	Else
		Set $msi_suffix$ = "F0"
	EndIf
 
	Message "Search Java 6.0.$x$ x64"
	Set $DisplayName$ = GetRegistryStringValue64 ( "[" + $Path$ + "{26A24AE4-039D-4CA4-87B4-2F864160" + "$x$" + $msi_suffix$ + "}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ = "{26A24AE4-039D-4CA4-87B4-2F864160" + "$x$" + $msi_suffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
 
 
 
[Sub_uninstall_7]
If ( "$x$" > "23" )
	Set $msi_suffix$ = "FF"
Else
	Set $msi_suffix$ = "F0"
EndIf
 
 
Message "Search Java JDK 7.0.$x$ x32"
If $INST_SystemType$ = "x86 System"
	Set $DisplayName$ = GetRegistryStringValue ( "[" + $Path$ + "{32A3A4F4-B792-11D6-A78A-00B0D0170$x$0}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ =     "{32A3A4F4-B792-11D6-A78A-00B0D0170$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
If $INST_SystemType$ = "64 Bit System"
	Set $DisplayName$ = GetRegistryStringValue32 ( "[" + $Path_64$ +         "{32A3A4F4-B792-11D6-A78A-00B0D0170$x$0}}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ =     "{32A3A4F4-B792-11D6-A78A-00B0D0170$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
 
	Message "Search Java JDK 7.0.$x$ x64"
	Set $DisplayName$ = GetRegistryStringValue64 ( "[" + $Path$ + "{64A3A4F4-B792-11D6-A78A-00B0D0170$x$0}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ = "{64A3A4F4-B792-11D6-A78A-00B0D0170$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
 
Message "Search Java JRE 7.0.$x$ x32"
If $INST_SystemType$ = "x86 System"
	Set $DisplayName$ = GetRegistryStringValue ( "[" + $Path$ + "{26A24AE4-039D-4CA4-87B4-2F832170" + "$x$" + $msi_suffix$ + "}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ = "{26A24AE4-039D-4CA4-87B4-2F832170" + "$x$" + $msi_suffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
If $INST_SystemType$ = "64 Bit System"
	Set $DisplayName$ = GetRegistryStringValue32 ( "[" + $Path_64$ + "{26A24AE4-039D-4CA4-87B4-2F832170" + "$x$" + $msi_suffix$ + "}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ = "{26A24AE4-039D-4CA4-87B4-2F832170" + "$x$" + $msi_suffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
 
	Message "Search Java 7.0.$x$ x64"
	Set $DisplayName$ = GetRegistryStringValue64 ( "[" + $Path$ + "{26A24AE4-039D-4CA4-87B4-2F864170" + "$x$" + $msi_suffix$ + "}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ = "{26A24AE4-039D-4CA4-87B4-2F864170" + "$x$" + $msi_suffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
 
 
 
 
[sub_uninstall_8]
; check on every update
If ( "$x$" >= "00" )
	Set $msi_suffix$ = "FF"
Else
	Set $msi_suffix$ = "F0"
EndIf
 
Message "Search Java JDK 8.0.$x$ x32"
If $INST_SystemType$ = "x86 System"
	Set $DisplayName$ = GetRegistryStringValue ( "[" + $Path$ + "{32A3A4F4-B792-11D6-A78A-00B0D0180$x$0}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ =     "{32A3A4F4-B792-11D6-A78A-00B0D0180$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
If $INST_SystemType$ = "64 Bit System"
	Set $DisplayName$ = GetRegistryStringValue32 ( "[" + $Path_64$ +  "{32A3A4F4-B792-11D6-A78A-00B0D0180$x$0}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ =     "{32A3A4F4-B792-11D6-A78A-00B0D0180$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
 
	Message "Search Java JDK 8.0.$x$ x64"
	Set $DisplayName$ = GetRegistryStringValue64 ( "[" + $Path$ + "{64A3A4F4-B792-11D6-A78A-00B0D0180$x$0}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ = "{64A3A4F4-B792-11D6-A78A-00B0D0180$x$0}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
 
Message "Search Java JRE 8.0.$x$ x32"
If $INST_SystemType$ = "x86 System"
	Set $DisplayName$ = GetRegistryStringValue ( "[" + $Path$ + "{26A24AE4-039D-4CA4-87B4-2F832180" + "$x$" + $msi_suffix$ + "}] DisplayName" )
	If Not ( $DisplayName$ = "" )
			Message "Uninstall " + $DisplayName$ + "..."
			Set $MSI$ =     "{26A24AE4-039D-4CA4-87B4-2F832180" + "$x$" + $msi_suffix$ + "}"
			Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf
 
If $INST_SystemType$ = "64 Bit System"
	Set $DisplayName$ = GetRegistryStringValue32 ( "[" + $Path_64$ + "{26A24AE4-039D-4CA4-87B4-2F832180" + "$x$" + $msi_suffix$ + "}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ = "{26A24AE4-039D-4CA4-87B4-2F832180" + "$x$" + $msi_suffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
 
	Message "Search Java JRE 8.0.$x$ x64"
	Set $DisplayName$ = GetRegistryStringValue64 ( "[" + $Path$ + "{26A24AE4-039D-4CA4-87B4-2F864180" + "$x$" + $msi_suffix$ + "}] DisplayName" )
	If Not ( $DisplayName$ = "" )
		Message "Uninstall " + $DisplayName$ + "..."
		Set $MSI$ = "{26A24AE4-039D-4CA4-87B4-2F864180" + "$x$" + $msi_suffix$ + "}"
		Sub "%ScriptPath%\delsub.ins"
	EndIf
EndIf

delsub.ins

delsub.ins
Set $UninstallCommand$ = 'msiexec.exe /X ' + $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 " + $DisplayName$
WinBatch_Uninstall /TimeOutSeconds 120
SetLogLevel = 1
Sub "%ScriptPath%\check_msi-exitcode.ins"
SetLogLevel = 1
 
Message "Uninstall " + $ProductId$ + " 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..."
DefVar $LogDir$
DefVar $DefaultLogLevel$
DefVar $exePath$
DefVar $Reg_Path$
DefVar $Reg_Path_64$
DefVar $msi32$
DefVar $exe_32$
DefVar $exe_64$
DefVar $exe_Argument_WebJava$
DefVar $exe_Argument_WebJava_Security_Level$
DefVar $exe_Arguments$
DefVar $msi_Argument_IExplorer$
DefVar $msi_Argument_Mozilla$
DefVar $msi_Argument_SysTray$
DefVar $msi_Argument_JavaUpdate$
DefVar $msi_Argument_Ju$
DefVar $msi_Argument_AutoUpdateCheck$
DefVar $msi_Arguments$
DefVar $MSI$
DefVar $java_vm_type$
DefVar $ExitCode$
DefVar $INST_MsVersion$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $ProductId$
DefVar $UninstallCommand$
DefVar $DisplayVersion$
DefVar $DisplayName$
DefVar $DisplayVersionx32$
DefVar $DisplayVersionx64$
DefVar $MinimumSpace$
DefVar $msi_suffix$
DefVar $Path$
DefVar $Path_64$
DefVar $update_Version$
DefStringList $version6$
DefStringList $version7$
DefStringList $version8$
 
Set $ProductId$								= "Java"
 
; Look up For new update versions of Java 6.
; https://en.wikipedia.org/wiki/Java_version_history#Java_6_updates
Set $version6$								= 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' )
 
; Add the new update version number to the stringlist, also add all version numbers you have skipped.
; https://en.wikipedia.org/wiki/Java_version_history#Java_7_updates
Set $version7$								= CreateStringList ( '00', '01', '02', '03', '04', '05', '06', '07', '09', '10', '11', '13', '15', '17', '21', '25', '40', '45', '51' )
 
; Add the new update version number to the stringlist, also add all version numbers you have skipped.
; https://en.wikipedia.org/wiki/Java_version_history
Set $version8$								= CreateStringList ( '00' )
 
For $x$ In $version8$ Do Set $update_Version$ = "$x$"
 
Set $DisplayVersion$						= "8"
Set $DefaultLogLevel$						= "5"
Set $MinimumSpace$							= "909 MB"
Set $LogDir$								= "%SystemDrive%\tmp"
Set $INST_SystemType$						= GetSystemType
Set $INST_MsVersion$						= GetMsVersionInfo
Set $java_vm_type$							= GetProductProperty ( "VM-Type"				, "jdk"		)
Set $exe_Argument_WebJava$					= GetProductProperty ( "WebJava"				, "On"		)
Set $exe_Argument_WebJava_Security_Level$	= GetProductProperty ( "WebJava-Security_Level"	, "H"		)
Set $msi_Argument_JavaUpdate$				= GetProductProperty ( "Java-Updater"			, "Off"		)
Set $INST_architecture$						= GetProductProperty ( "install_architecture"	, "Both"	)
Set $msi32$									= "msi\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0.msi"
Set $exe_32$								= $java_vm_type$ + "-" + $DisplayVersion$ + "-windows-i586.exe"
Set $exe_64$								= $java_vm_type$ + "-" + $DisplayVersion$ + "-windows-x64.exe"
Set $Path$									= "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set $Path_64$								= "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
Set $msi_suffix$							= ""
Set $DisplayName$							= $ProductId$ + " " + $DisplayVersion$
Set $DisplayVersionx32$						= $DisplayName$ + " " + $java_vm_type$ + " x32"
Set $DisplayVersionx64$						= $DisplayName$ + " " + $java_vm_type$ + " x64"
Set $exePath$								= "%ScriptPath%\setup_data\"
 
If $exe_Argument_WebJava$ = "On"
	Set $exe_Argument_WebJava$ = "WEB_JAVA=1"
	Set $msi_Argument_IExplorer$ = "IEXPLORER=1"
	Set $msi_Argument_Mozilla$ = "MOZILLA=1"
Else
	Set $exe_Argument_WebJava$ = "WEB_JAVA=0"
	Set $msi_Argument_IExplorer$ = "IEXPLORER=0"
	Set $msi_Argument_Mozilla$ = "MOZILLA=0"
EndIf
 
If $exe_Argument_WebJava_Security_Level$ = "M"
	Set $exe_Argument_WebJava_Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=M"
EndIf
If $exe_Argument_WebJava_Security_Level$ = "H"
	Set $exe_Argument_WebJava_Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=H"
EndIf
If $exe_Argument_WebJava_Security_Level$ = "VH"
	Set $exe_Argument_WebJava_Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=VH"
EndIf
 
If $msi_Argument_JavaUpdate$ = "On"
	Set $msi_Argument_SysTray$ = "SYSTRAY=1"
	Set $msi_Argument_JavaUpdate$ = "JAVAUPDATE=1"
	Set $msi_Argument_Ju$ = "JU=1"
	Set $msi_Argument_AutoUpdateCheck$ = "AUTOUPDATECHECK=1"
Else
	Set $msi_Argument_SysTray$ = "SYSTRAY=0"
	Set $msi_Argument_JavaUpdate$ = "JAVAUPDATE=0"
	Set $msi_Argument_Ju$ = "JU=0"
	Set $msi_Argument_AutoUpdateCheck$ = "AUTOUPDATECHECK=0"
EndIf
 
Set $exe_Arguments$ = "/s " + $exe_Argument_WebJava$ + " " + $exe_Argument_WebJava_Security_Level$
Set $msi_Arguments$ = "/qb! REBOOT=ReallySuppess " + $msi_Argument_IExplorer$ + " " + $msi_Argument_Mozilla$ + " " + $msi_Argument_SysTray$ + " " + $msi_Argument_JavaUpdate$ + " " + $msi_Argument_Ju$ + " " + $msi_Argument_AutoUpdateCheck$
 
ShowBitMap /3 "%ScriptPath%\java.png" $ProductId$
SetLogLevel = $DefaultLogLevel$
 
If $INST_MsVersion$ < "5.1"
	LogError "Minimum Windows XP is required For Java >= 1.$DisplayVersion$"
	IsFatalError "Minimum Windows XP is required For Java >= 1." + $DisplayVersion$
EndIf
If Not ( HasMinimumSpace ( "%SystemDrive%", $MinimumSpace$ ) )
	LogError "Not enough space on %SystemDrive%, $MinimumSpace$ on drive %SystemDrive% needed For $ProductId$"
	IsFatalError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed For " + $ProductId$
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 $INST_SystemType$ = "64 Bit System"
        Message "Install " + $DisplayVersionx64$
		If FileExists ( $exePath$ + $exe_64$ )
			SetLogLevel = 6
			WinBatch_install_x64 /WaitOnClose
			SetLogLevel = 1
		Else
			LogError "File not found: $exePath$$exe_64$"
			IsFatalError "File not found: $exePath$$exe_64$"
		EndIf
        Sub "%ScriptPath%\check_msi-exitcode.ins"
		If $msi_Argument_JavaUpdate$ = "JAVAUPDATE=1"
			Registry_disable_update /64Bit
		EndIf
 
		If $INST_architecture$ = "Both"
			Message "Install " + $DisplayVersionx32$
			If FileExists ( $exePath$ + $exe_32$ )
				SetLogLevel = 6
				WinBatch_install_x86_64_UseExe /WaitOnClose
				SetLogLevel = 1
			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 $ExitCode$ = GetLastExitCode
			If $ExitCode$ = "1619"
				Comment "ExitCode = " + $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
				If $java_vm_type$ = "jdk"
					If FileExists ( $exePath$ + $msi32$ )
						SetLogLevel = 6
						WinBatch_install_x86_64_UseMSI /WaitOnClose
						SetLogLevel = 1
					Else
						LogError "File not found: $exePath$$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 $msi32$ = "msi\jre1." + $DisplayVersion$ + ".0\jre1." + $DisplayVersion$ + ".0.msi"
				If FileExists ( $exePath$ + $msi32$ )
					SetLogLevel = 6
					WinBatch_install_x86_64_UseMSI /WaitOnClose
					SetLogLevel = 1
				Else
					LogError "File not found: $exePath$$msi32$"
					IsFatalError "File not found: $exePath$$msi32$"
				EndIf
				Set $msi32$ = "msi\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0.msi"
			Else
				Sub "%ScriptPath%\check_msi-exitcode.ins"
			EndIf
			If $msi_Argument_JavaUpdate$ = "JAVAUPDATE=1"
				Registry_disable_update /32Bit
			EndIf
		EndIf
EndIf
 
; #############################################################################################################################################
; ################################################################### Install x32 ###################################################################
; #############################################################################################################################################
If $INST_SystemType$ = "x86 System"
        Message "Install " + $DisplayVersionx32$
		If FileExists ( $exePath$ + $exe_32$ )
			SetLogLevel = 6
			WinBatch_install_x86 /WaitOnClose
			SetLogLevel = 1
			Sub "%ScriptPath%\check_msi-exitcode.ins"
		Else
			LogError "File not found: $exePath$$exe_32$"
			IsFatalError "File not found: $exePath$$exe_32$"
		EndIf
		If $msi_Argument_JavaUpdate$ = "JAVAUPDATE=1"
			Registry_disable_update /32Bit
		EndIf
EndIf
 
; Patch JCE
If $INST_SystemType$ = "64 Bit System"
	If FileExists ( "%ProgramFiles64Dir%\Java\jre" + $DisplayVersion$ + "\bin\java.exe" )
		Message "Apply patch For JCE (Java Cryptography Extension)"
		If $java_vm_type$ = "jdk" And FileExists ( "%ProgramFiles64Dir%\Java\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0\bin\javac.exe" )
			Files_patch_JCE_JDK_x64
		EndIf
		If $java_vm_type$ = "jdk" And ( Not ( FileExists ( "%ProgramFiles64Dir%\Java\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0\bin\javac.exe" ) ) )
			LogWarning "NOT Patching JCE for x64 JDK; File not found: %ProgramFiles64Dir%\Java\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0\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" + $DisplayVersion$ + "\bin\java.exe"
	EndIf
EndIf
 
If FileExists ( "%ProgramFiles32Dir%\Java\jre" + $DisplayVersion$ + "\bin\java.exe" )
	Message "Apply patch For JCE (Java Cryptography Extension)"
	If $java_vm_type$ = "jdk" And FileExists ( "%ProgramFiles32Dir%\Java\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0\bin\javac.exe" )
		Files_patch_JCE_JDK_x86
	EndIf
	If $java_vm_type$ = "jdk" And ( Not ( FileExists ( "%ProgramFiles32Dir%\Java\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0\bin\javac.exe" ) ) )
		LogWarning "NOT Patching JCE for x86 JDK; File not found: %ProgramFiles64Dir%\Java\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0\bin\javac.exe"
	EndIf
	Files_patch_JCE_JRE_x86
Else
	LogWarning "NOT Patching JCE for x86 JRE and JDK; File not found: %ProgramFiles64Dir%\Java\jre" + $DisplayVersion$ + "\bin\java.exe"
EndIf
 
Message "Install complete"
 
[WinBatch_install_x86_64_UseExe]
"$exePath$$exe_32$" $exe_Arguments$
 
[WinBatch_install_x86_64_UseMSI]
msiexec /i "$exePath$$msi32$" $msi_Arguments$
 
[WinBatch_install_x86]
"$exePath$$exe_32$" $exe_Arguments$
 
[WinBatch_install_x64]
"$exePath$$exe_64$" $exe_Arguments$
 
[Files_delete_broken_x86_x64]
Delete -fs "%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\jdk1.$DisplayVersion$.0\jre\lib\security"
 
[Files_patch_JCE_JDK_x64]
Copy -s "%ScriptPath%\UnlimitedJCEPolicy\*.*" "%ProgramFiles64Dir%\Java\jdk1.$DisplayVersion$.0\jre\lib\security"
 
[Files_patch_JCE_JRE_x86]
Copy -s "%ScriptPath%\UnlimitedJCEPolicy\*.*" "%ProgramFiles32Dir%\Java\jre$DisplayVersion$\lib\security"
 
[Files_patch_JCE_JRE_x64]
Copy -s "%ScriptPath%\UnlimitedJCEPolicy\*.*" "%ProgramFiles64Dir%\Java\jre$DisplayVersion$\lib\security"

uninstall.ins

uninstall.ins
[Initial]
SetLogLevel = 5
ExitOnError = True
ScriptErrorMessages = Off
TraceMode = Off
StayOnTop = False
 
[Actions]
RequiredWinstVersion >= "4.11.3"
Message "Prepare..."
DefVar $LogDir$
DefVar $DefaultLogLevel$
DefVar $exePath$
DefVar $Reg_Path$
DefVar $Reg_Path_64$
DefVar $msi32$
DefVar $exe_32$
DefVar $exe_64$
DefVar $exe_Argument_WebJava$
DefVar $exe_Argument_WebJava_Security_Level$
DefVar $exe_Arguments$
DefVar $msi_Argument_IExplorer$
DefVar $msi_Argument_Mozilla$
DefVar $msi_Argument_SysTray$
DefVar $msi_Argument_JavaUpdate$
DefVar $msi_Argument_Ju$
DefVar $msi_Argument_AutoUpdateCheck$
DefVar $msi_Arguments$
DefVar $MSI$
DefVar $java_vm_type$
DefVar $ExitCode$
DefVar $INST_MsVersion$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $ProductId$
DefVar $UninstallCommand$
DefVar $DisplayVersion$
DefVar $DisplayName$
DefVar $DisplayVersionx32$
DefVar $DisplayVersionx64$
DefVar $MinimumSpace$
DefVar $msi_suffix$
DefVar $Path$
DefVar $Path_64$
DefVar $update_Version$
DefStringList $version6$
DefStringList $version7$
DefStringList $version8$
 
Set $ProductId$								= "Java"
 
; Look up For new update versions of Java 6.
; https://en.wikipedia.org/wiki/Java_version_history#Java_6_updates
Set $version6$								= 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' )
 
; Add the new update version number to the stringlist, also add all version numbers you have skipped.
; https://en.wikipedia.org/wiki/Java_version_history#Java_7_updates
Set $version7$								= CreateStringList ( '00', '01', '02', '03', '04', '05', '06', '07', '09', '10', '11', '13', '15', '17', '21', '25', '40', '45', '51' )
 
; Add the new update version number to the stringlist, also add all version numbers you have skipped.
; https://en.wikipedia.org/wiki/Java_version_history
Set $version8$								= CreateStringList ( '00' )
 
For $x$ In $version8$ Do Set $update_Version$ = "$x$"
 
Set $DisplayVersion$						= "8"
Set $DefaultLogLevel$						= "5"
Set $MinimumSpace$							= "909 MB"
Set $LogDir$								= "%SystemDrive%\tmp"
Set $INST_SystemType$						= GetSystemType
Set $INST_MsVersion$						= GetMsVersionInfo
Set $java_vm_type$							= GetProductProperty ( "VM-Type"				, "jdk"		)
Set $exe_Argument_WebJava$					= GetProductProperty ( "WebJava"				, "On"		)
Set $exe_Argument_WebJava_Security_Level$	= GetProductProperty ( "WebJava-Security_Level"	, "H"		)
Set $msi_Argument_JavaUpdate$				= GetProductProperty ( "Java-Updater"			, "Off"		)
Set $INST_architecture$						= GetProductProperty ( "install_architecture"	, "Both"	)
Set $msi32$									= "msi\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0\" + $java_vm_type$ + "1." + $DisplayVersion$ + ".0.msi"
Set $exe_32$								= $java_vm_type$ + "-" + $DisplayVersion$ + "-windows-i586.exe"
Set $exe_64$								= $java_vm_type$ + "-" + $DisplayVersion$ + "-windows-x64.exe"
Set $Path$									= "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set $Path_64$								= "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
Set $msi_suffix$							= ""
Set $DisplayName$							= $ProductId$ + " " + $DisplayVersion$
Set $DisplayVersionx32$						= $DisplayName$ + " " + $java_vm_type$ + " x32"
Set $DisplayVersionx64$						= $DisplayName$ + " " + $java_vm_type$ + " x64"
Set $exePath$								= "%ScriptPath%\setup_data\"
 
If $exe_Argument_WebJava$ = "On"
	Set $exe_Argument_WebJava$ = "WEB_JAVA=1"
	Set $msi_Argument_IExplorer$ = "IEXPLORER=1"
	Set $msi_Argument_Mozilla$ = "MOZILLA=1"
Else
	Set $exe_Argument_WebJava$ = "WEB_JAVA=0"
	Set $msi_Argument_IExplorer$ = "IEXPLORER=0"
	Set $msi_Argument_Mozilla$ = "MOZILLA=0"
EndIf
 
If $exe_Argument_WebJava_Security_Level$ = "M"
	Set $exe_Argument_WebJava_Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=M"
EndIf
If $exe_Argument_WebJava_Security_Level$ = "H"
	Set $exe_Argument_WebJava_Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=H"
EndIf
If $exe_Argument_WebJava_Security_Level$ = "VH"
	Set $exe_Argument_WebJava_Security_Level$ = "WEB_JAVA_SECURITY_LEVEL=VH"
EndIf
 
If $msi_Argument_JavaUpdate$ = "On"
	Set $msi_Argument_SysTray$ = "SYSTRAY=1"
	Set $msi_Argument_JavaUpdate$ = "JAVAUPDATE=1"
	Set $msi_Argument_Ju$ = "JU=1"
	Set $msi_Argument_AutoUpdateCheck$ = "AUTOUPDATECHECK=1"
Else
	Set $msi_Argument_SysTray$ = "SYSTRAY=0"
	Set $msi_Argument_JavaUpdate$ = "JAVAUPDATE=0"
	Set $msi_Argument_Ju$ = "JU=0"
	Set $msi_Argument_AutoUpdateCheck$ = "AUTOUPDATECHECK=0"
EndIf
 
Set $exe_Arguments$ = "/s " + $exe_Argument_WebJava$ + " " + $exe_Argument_WebJava_Security_Level$
Set $msi_Arguments$ = "/qb! REBOOT=ReallySuppess " + $msi_Argument_IExplorer$ + " " + $msi_Argument_Mozilla$ + " " + $msi_Argument_SysTray$ + " " + $msi_Argument_JavaUpdate$ + " " + $msi_Argument_Ju$ + " " + $msi_Argument_AutoUpdateCheck$
 
ShowBitMap /3 "%ScriptPath%\java.png" $ProductId$
SetLogLevel = $DefaultLogLevel$
 
Sub "%ScriptPath%\check_uninstall.ins"
 
Message "Uninstall complete"
userspace/java-ng.1396037270.txt.gz · Last modified: 2021/08/23 08:37 (external edit)