我试图在Ubuntu机器上运行maven项目,但它无法找到Java
Compilation failure
Unable to locate the Javac Compiler in:
/usr/lib/jvm/java-6-openjdk/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.
这是我的etc / environment文件
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:u$
JAVA_HOME=”/usr/lib/jvm/java-6-openjdk/jre”
M2_HOME=”/usr/local/apache-maven/apache-maven-3.1.0″
MAVEN_HOME=”/usr/local/apache-maven/apache-maven-3.1.0″
M2=”/usr/local/apache-maven/apache-maven-3.1.0/bin”
为了使我的问题更清楚,我可以提供哪些其他信息?
答案 0 :(得分:2)
我认为JAVA_HOME="/usr/lib/jvm/java-6-openjdk/jre"
是问题所在。 Maven日志清楚地表明你的路径应该指向JDK而不仅仅是JRE。所以试试
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk