【发布时间】:2014-01-27 21:20:46
【问题描述】:
我正在尝试在我的 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,但我缺少文件。我该如何解决?
【问题讨论】:
-
您在 JRE 中搜索,而信息消息明确表示不可能。
-
我会切换到oracle的jdk。我记得在 ubuntu 机器上打开 jdk 有很多问题。
-
JRE 是 Java 运行时环境——运行 Java 程序所需的一切。您需要的是用于编译 Java 程序的JDK(Java Development Kit)。
-
知道了,谢谢你的提示!
标签: java linux maven ubuntu openjdk