Unable to locate the Javac Compiler 解决办法

    在使用eclipse对maven项目进行编译打包(Run As->Maven install)时,报以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project jshop: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:Program Files (x86)Javajre7..lib ools.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).

右击该项目->Properties->Java Build Path,使用jre7变量:


jre7变量指向安装的jre路径如下:



这个路径是无法找到上面报错信息中提到的C:Program Files (x86)Javajre7..lib ools.jar,所以需要将该jre7变量指定的路径更新为C:Program Files (x86)Javajdk1.7.0_60jre(根据自己电脑上实际jdk下jre目录指定),即Window->Preferences->Java->Installed JREs:

点击“Apply”->“OK”按钮后,重新编译该项目成功。

原文地址:https://www.cnblogs.com/atai/p/6089378.html