1. 程式人生 > >Unable to locate the Javac Compiler 解決辦法

Unable to locate the Javac Compiler 解決辦法

在使用eclipse 執行 maven install的時候,出現這個錯誤:

[ERROR] Unable to locate the Javac Compiler in:
  D:\Program Files\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.

 

解決方法:

window-->preferences-->java-->Installed JREs,編輯此項,改成jdk路徑即可(之前報錯是jre路徑),如下圖