每次我在 Eclipse 中更改 pom.xml 时都会收到错误消息。
Build errors for myapp; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project web: Compilation failure
Unable to locate the Javac Compiler in:
C:\Program Files (x86)\Java\jre6\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable
我已经设置了 JAVA_HOME 环境变量。就是:JAVA_HOME=D:\Java\jdk1.6.0_23
谢谢。
最佳答案
这是我为解决该问题所做的步骤(Eclipse 3.7 Indigo):
Window -> Preferences -> Java -> installed JREs -> 我有一个来自 JDK 位置的 JRE,我的位置看起来像 C:\Program Files\Java\jdk1.6.0 _26
Window -> Preferences -> Java -> installed JREs -> Execution Environments -> 选择 JavaSE-1.6 并选择一个兼容的 JDK,它应该是上一步中设置的那个。
关于java - Eclipse 中的 Maven 在 POM 更改时提示 "Unable to locate the Javac Compiler",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5163021/