當我運行Jenkins從存儲庫檢出代碼並執行mvn package
或某些命令時。我得到這個錯誤:Java編譯錯誤無法配置JAVA_HOME
Unable to locate the Javac Compiler in: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../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.
My JAVA_HOME points at jdk location only.Still it looks at
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/tools.jar 編譯器。這是爲什麼???
看來問題出在代碼中。它指向/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/用於tools.jar ,但它需要查看/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/lib/,其中jar是存在的。我試着將jar複製到jre/lib /中,但是卻沒有avail.Any解決方案... 謝謝你的答案無論如何..
你有沒有試過設置你的JAVA_HOME環境變量? – Abubakkar
嘗試'哪個java'命令,然後'java -version',然後查看您已安裝jdk的位置,或確認您是否有jdk或只有JRE – khan
我的JDK指向/jdk1.7.0_05/bin/java – user1728119