java无法在Linux Ubuntu 12.04上运行maven2
我正在尝试在Linux 12.04中使用maven编译一个程序。为此,我使用mvn clean install
命令。但是,我得到一个生成错误:
[ERROR] Unable to locate the Javac Compiler in:
/usr/lib/jvm/java-6-openjdk-amd64/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.
我检查了路径,实际上我丢失了那个关键文件。这就是我所拥有的:
user@modelX:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib$ ls
accessibility.properties im net.properties
amd64 images psfontj2d.properties
calendars.properties jar.binfmt psfont.properties.ja
charsets.jar javazic.jar resources.jar
classlist jce.jar rhino.jar
cmm jexec rt.jar
compilefontconfig.jar jsse.jar security
content-types.properties jvm.hprof.txt sound.properties
currency.data logging.properties swing.properties
ext management tz.properties
flavormap.properties management-agent.jar zi
fontconfig.properties meta-index
显然,我运行的是openJDK,但我缺少文件。我该如何解决这个问题
# 1 楼答案
确保您选择了正确的jdk:
我必须选择/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java来运行mvn。不祥的是,有一种工具。jar在/usr/lib/jvm/java-7-openjdk-amd64/,但在/usr/lib/jvm/java-6-openjdk-amd64/
# 2 楼答案
很明显我错过了一些重要的包裹。我在这个网站上找到了解决方案:
# 3 楼答案
请确保
JAVA_HOME
指向/usr/lib/jvm/java-6-openjdk-amd64/
# 4 楼答案
运行javac:
如果找不到,请检查路径:
它应该包含