如何处理Maven build时的error message Unable to locate the Javac Compiler in tools.jar

296 阅读1分钟

Created by Jerry Wang, last modified on Sep 01, 2015

Unable to locate the Javac Compiler in: C:\Program Files\Java\jre7…\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.

修改之前的Installed JREs 配置:
clipboard1
手动添加一个新的JRE home, location为JDK所属的JRE directory:
clipboard2
选中新添加的JDK:
clipboard3
在Execution environment里选中新添加的JDK:
clipboard4
issue resolved:
clipboard5
成功build出来的jar包:
clipboard6