mirror of
https://github.com/rife2/bld
synced 2025-12-20 16:48:38 +01:00
Fix to the bld wrapper to take java.home into account for the java executable, otherwise there can be a mismatch between the javac version and the java version
This commit is contained in:
parent
a616a8a8f6
commit
a7c29080f5
|
|
@ -642,7 +642,7 @@ public class Wrapper {
|
||||||
private int launchMainCli(File jarFile, List<String> arguments)
|
private int launchMainCli(File jarFile, List<String> arguments)
|
||||||
throws IOException, InterruptedException {
|
throws IOException, InterruptedException {
|
||||||
var args = new ArrayList<String>();
|
var args = new ArrayList<String>();
|
||||||
args.add("java");
|
args.add(findJavaExecutable());
|
||||||
includeJvmProperties(arguments, args);
|
includeJvmProperties(arguments, args);
|
||||||
|
|
||||||
args.add("-cp");
|
args.add("-cp");
|
||||||
|
|
@ -695,7 +695,7 @@ public class Wrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
var java_args = new ArrayList<String>();
|
var java_args = new ArrayList<String>();
|
||||||
java_args.add("java");
|
java_args.add(findJavaExecutable());
|
||||||
includeJvmProperties(arguments, java_args);
|
includeJvmProperties(arguments, java_args);
|
||||||
|
|
||||||
java_args.add("-cp");
|
java_args.add("-cp");
|
||||||
|
|
@ -712,6 +712,15 @@ public class Wrapper {
|
||||||
return process.waitFor();
|
return process.waitFor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String findJavaExecutable() {
|
||||||
|
var executable = System.getProperty("os.name").toLowerCase().contains("win") ? "java.exe" : "java";
|
||||||
|
var java_home = System.getProperty("java.home");
|
||||||
|
if (null == java_home) {
|
||||||
|
return executable;
|
||||||
|
}
|
||||||
|
return java_home + File.separator + "bin" + File.separator + executable;
|
||||||
|
}
|
||||||
|
|
||||||
private static void includeJvmProperties(List<String> arguments, List<String> javaArgs) {
|
private static void includeJvmProperties(List<String> arguments, List<String> javaArgs) {
|
||||||
var i = arguments.iterator();
|
var i = arguments.iterator();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue