出現的bug提示
Unable to locate the Javac Compiler in:
C:\Program Files\Java\jre1.6.0_07\..\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.
從上面的Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required)
可以看出m2e要求用於編譯應該要用jdk且jdk是1.4及以上的版本才行
我在命令行下echo %JAVA_HOME%
檢查了一下我的"JAVA_HOME"是C:\Program Files\Java\jdk1.6.0_20
那是哪里出錯了呢,,這時我意識到我用的是m2e,那么我的運行時環境應該就是根據
eclipse(eclipse也有默認也有自己的運行時環境)指定的才是,,那么我只要把修改eclipse指定的運行時環境路徑不就可以了,
於是
1、在eclipse里面修改 "window-->preferences->java->installed jres" 如圖:
edit the selected jre or add a new jre and select it
the location should be "C:\Program Files\Java\jdk1.6.0_20\jre"
please don't close the "Edit JRE" dialog ,continue the second step.
2、remove the default jre system libraries and add all the jar in the lib folder, lib subdirectory in %JAVA_HOME%/jdk**/jre/
illustration:
_^^_.......I wish this bug report message will help u....and please comment this ...
在用maven的這些日子以來,發現還有一種可能出現這種錯誤,就是你已經install了你的項目,,這時出現這種bug時,你需到倉庫去把這些已存在的版本刪除即可