Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer executable in JAVA_HOME when defined #46

Closed
AlexFalappa opened this issue Nov 13, 2019 · 0 comments · Fixed by #47
Closed

Prefer executable in JAVA_HOME when defined #46

AlexFalappa opened this issue Nov 13, 2019 · 0 comments · Fixed by #47

Comments

@AlexFalappa
Copy link
Contributor

It would be great to prefer the java executable found in a user explicitly defined JAVA_HOME.

I had an issue on a centrally managed Windows 10 system where an Oracle JRE 8 was defined in the system path and I couldn't override it by redefining the PATH in the local user account environment variables definition, this prevented execution of maven javafx:run for example with missing --modulepath error.

At the moment a java is found in the system executable path is chosen, the following two blocks should be flipped:

if (exec == null && OS.isFamilyWindows()) {
List<String> paths = this.getExecutablePaths(enviro);
paths.add(0, dir.getAbsolutePath());
exec = findExecutable(executable, paths);
}
if (exec == null) {
String javaHome = System.getProperty("java.home", getJavaHome(enviro));
if (javaHome != null && ! javaHome.isEmpty()) {
exec = findExecutable(executable, Arrays.asList(javaHome.concat(File.separator).concat("bin")));
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant