-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Cannot run program "/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/javac"
#619
Comments
This problem is triggered by the following maven config:
|
Please provide a complete standalone reproducer like described in here, otherwise there's no way to help. |
Happened to me as well. The situation occurs when the environment variable |
Can't say what happens exactly on your setup. I'd say the issue if with your setup and you have to provide a proper JDK and note a simple JRE if you want to compile Java code too. I'm closing for now. I'll reopen if someone finds an issue with the Java resolution and provides a reproducer. |
@slandelle yes, in my case I have Java sources as well. And I provide a JDK, not a JRE, but not in the environment variable |
Why? Why would it have precedence over the JVM that was used to launch maven? |
Because the JVM that was used to launch Maven is a JDK. It's the java executable from a JDK. |
Yes |
Here you go. To reproduce the error:
|
This is a Windows specific error and I don't have a Windows machine. @roti Could you please provide me with the full content layout of your |
@slandelle It's the JDK from the Temurin Project: https://adoptium.net/temurin/releases/?version=8 |
Motivation: 1. We should prefer the Java installation used to run maven to what's defined in JAVA_HOME 2. We should prefer JDK over JRE (for old versions that used to have one) as we need javac for compiling Java code in mixed projects Modifications: Resolve with the following chain: * prefer toolchain if defined * try to use "java.home" System prop to resolve a JDK, a JRE otherwise * fall back to JAVA_HOME env var Result: Behavior consistent with `maven-compiler-plugin` and `org.codehaus.plexus.compiler.javac.JavacCompiler#getJavacExecutable`. In particular: * we no longer unexpectedly jump to a different Java install because JAVA_HOME env var is defined * we no longer crash on Java 8 when trying to compile mixed projects and JAVA_HOME env var is undefined or doesn't point to a JDK.
Motivation: 1. We should prefer the Java installation used to run maven to what's defined in JAVA_HOME 2. We should prefer JDK over JRE (for old versions that used to have one) as we need javac for compiling Java code in mixed projects Modifications: Resolve with the following chain: * prefer toolchain if defined * try to use "java.home" System prop to resolve a JDK, a JRE otherwise * fall back to JAVA_HOME env var Result: Behavior consistent with `maven-compiler-plugin` and `org.codehaus.plexus.compiler.javac.JavacCompiler#getJavacExecutable`. In particular: * we no longer unexpectedly jump to a different Java install because JAVA_HOME env var is defined * we no longer crash on Java 8 when trying to compile mixed projects and JAVA_HOME env var is undefined or doesn't point to a JDK.
Motivation: gatling-maven-plugin and the bundle have to locate the java executable in order to spawn a forked process to run Gatling. The current strategy is broken: * it favors the JAVA_HOME env var over the launcher's JVM * if JAVA_HOME is undefined and Java 8 is used, it will pick the JRE instead of the JDK, causing crashes when compiling Java code This is the same issue as davidB/scala-maven-plugin#619 Modification: * Share Java location resolution is commons module. * Favor current JVM over JAVA_HOME * Favor JDK over JRE
Motivation: gatling-maven-plugin and the bundle have to locate the java executable in order to spawn a forked process to run Gatling. The current strategy is broken: * it favors the JAVA_HOME env var over the launcher's JVM * if JAVA_HOME is undefined and Java 8 is used, it will pick the JRE instead of the JDK, causing crashes when compiling Java code This is the same issue as davidB/scala-maven-plugin#619 Modification: * Share Java location resolution is commons module. * Favor current JVM over JAVA_HOME * Favor JDK over JRE
When compiling, it cannot find the proper javac path:
The text was updated successfully, but these errors were encountered: