Maven 错误:也许您在 JRE 而不是 JDK 上运行? [英] Maven error :Perhaps you are running on a JRE rather than a JDK?
问题描述
我以前从未使用过 Maven,我正在按照说明操作 此处. 当我运行命令时
I've never worked with Maven before and I am following the instructions here. When I run the command
mvn integration-test -Pamp-to-war
最初下载了一大堆依赖,最后显示,
It initially downloaded a whole bunch of dependencies, and in the end it showed,
COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
我使用的是 ubuntu 13.04.
I am on ubuntu 13.04.
如果你有什么想让我告诉你的,请告诉我.谢谢.
If there's anything you want me to tell you, let me know. Thanks.
编辑
当我执行 echo $JAVA_HOME
我得到 /usr/lib/jvm/java-7-openjdk-i386/
当我做 mvn -version
我明白了,
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-i386/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-26-generic", arch: "i386", family: "unix"
另外,我发现了其他人面临的这个问题.但我不确定如何执行指定的解决方案?
Also, I found out this problem faced by someone else. But I am not sure how to go about the solution that is specified?
进一步编辑.
kraken@kraken-Inspiron-1545:/usr/lib/jvm/java-7-openjdk-i386$ ls -l
total 12
drwxr-xr-x 2 root root 4096 Sep 9 10:44 bin
lrwxrwxrwx 1 root root 41 Jul 4 2013 docs -> ../../../share/doc/openjdk-7-jre- headless
drwxr-xr-x 5 root root 4096 Oct 13 2013 jre
drwxr-xr-x 4 root root 4096 Oct 13 2013 man
推荐答案
显然,它需要我的 $JAVA_HOME 的 lib 文件夹中的 tools.jar 文件.我没有 lib 文件夹,所以我使用命令
Apparently, it requires tools.jar file inside the lib folder of my $JAVA_HOME. I did not have the lib folder, so I reinstalled my jdk using command
apt-get install openjdk-7-jdk openjdk-7-doc openjdk-7-jre-lib
这篇关于Maven 错误:也许您在 JRE 而不是 JDK 上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!