Skip to content

Commit

Permalink
[JENKINS-19447] JDK installation hangs forever
Browse files Browse the repository at this point in the history
(cherry picked from commit 63bffae)
  • Loading branch information
Gili Tzabari authored and olivergondza committed Oct 18, 2013
1 parent 07432c2 commit 137d82b
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions core/src/main/java/hudson/tools/JDKInstaller.java
Expand Up @@ -224,16 +224,28 @@ I tried to locate exactly how InstallShield parses the arguments (and why it use
*/
String logFile = jdkBundle+".install.log";

expectedLocation = expectedLocation.trim();
if (expectedLocation.endsWith("\\")) {
// Prevent a trailing slash from escaping quotes
expectedLocation = expectedLocation.substring(0, expectedLocation.length() - 1);
}
ArgumentListBuilder args = new ArgumentListBuilder();
args.add(jdkBundle);
assert (new File(expectedLocation).exists()) : expectedLocation
+ " must exist, otherwise /L will cause the installer to fail with error 1622";
if (isJava15() || isJava14()) {
args.add("/s","/v/qn REBOOT=ReallySuppress INSTALLDIR=\""+ expectedLocation +"\" /L \""+logFile+"\"");
// Installer uses InstallShield.
args.add("CMD.EXE", "/C");

// CMD.EXE /C must be followed by a single parameter (do not split it!)
args.add(jdkBundle + " /s /v\"/qn REBOOT=ReallySuppress INSTALLDIR=\\\""
+ expectedLocation + "\\\" /L \\\"" + expectedLocation
+ "\\jdk.exe.install.log\\\"\"");
} else {
// modern version supports arguments in more sane format.
args.add("/s","/v","/qn","/L","\""+logFile+"\"","REBOOT=ReallySuppress","INSTALLDIR=\""+ expectedLocation+"\"");
// Installed uses Windows Installer (MSI)
args.add(jdkBundle, "/s", "REBOOT=ReallySuppress",
"INSTALLDIR=" + expectedLocation,
"/L \\\"" + expectedLocation + "\\jdk.exe.install.log\\\"");
}
// according to http://community.acresso.com/showthread.php?t=83301, \" is the trick to quote values with whitespaces.
// Oh Windows, oh windows, why do you have to be so difficult?
int r = launcher.launch().cmds(args).stdout(out)
.pwd(new FilePath(launcher.getChannel(), expectedLocation)).join();
if (r != 0) {
Expand Down

0 comments on commit 137d82b

Please sign in to comment.