I'm facing a strange problem when trying to run clean and install on maven. I get the following error message:
Caused by: org.codehaus.plexus.compiler.CompilerException: tools.jar not found: C:\Program Files\Java\jre1.8.0_25\..\lib\tools.jar
at org.codehaus.plexus.compiler.javac.JavacCompiler.createJavacClass(JavacCompiler.java:987)
at org.codehaus.plexus.compiler.javac.JavacCompiler.getJavacClass(JavacCompiler.java:944)
at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:520)
at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:167)
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:678)
... 14 more
I looked for common causes of this issue and most of them says that the problem must be that I need to point a JDK in my installed JRE's (and in the error message I see that it is actually pointing a JRE). But when I check my installed JRE's it is pointing to a JDK:
Java Home is set here:
Any ideas of what may be causing this error?
您正在使用JRE,您需要将JAVA_HOME
环境变量设置为JDK路径。
Did you change your PATH
from the time when it was working? When you do mvn clean install
from command line, Maven delegates the build of Java sources to javac
found in the PATH
. A quick check would be to set the PATH
as set PATH="<path-to-jdk\\bin>;<rest>"
and retry mvn clean install
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.