java - Maven 无法定位 Javac 编译器 - 无法在 : 中定位 Javac 编译器

标签 java maven m2e

当我尝试在我的 gwt-maven Projekt 上进行 maven-install 时,我得到了这个错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project MyProject: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Development\java jre7\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

但是 JAVA_HOME 已设置。当我运行 cmd "echo %JAVA_HOME%" 它说 C:\Development\jdk7 这是正确的。 不知道他为什么要搜索 C:\Development\java jre7.....

最佳答案

如果是 JDK,看起来您的 JAVA_HOME 可能指向 JRE?

C:\Development\java jre7\..\lib\tools.jar

你有安装JDK吗?如果是这样,请将您的 JAVA_HOME 更改为指向 JDK。 如果没有,请先下载JDK,然后设置JAVA_HOME。

更新

因为您是从 Eclipse 内部运行的,所以您的答案在 SO 上- 您需要告诉 Eclipse 使用 JDK 而不是 JRE。

关于java - Maven 无法定位 Javac 编译器 - 无法在 : 中定位 Javac 编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14173644/

相关文章:

java - PHP 时间戳转 Java 时间戳

java - 线程安全唯一编号生成器

java - scalac如何标记编译文件?

maven - 如何在 Maven 中定义依赖范围以在编译、运行、测试中包含一个库,但不在程序集/打包中?

java - 将 Eclipse M2E Web 应用程序依赖项移至项目文件系统中

java - M2eclipse依赖解析

java - 解决循环引用

java - 无法在 Tomcat 8.0 :Failed to start component [StandardEngine[Catalina]. StandardHost[localhost].StandardContext 中部署我的项目

java - Maven Jib 插件 : 401 Unauthorized

eclipse - 无法为 Juno 的 EGit 安装 Maven SCM 处理程序