maven with java home中的编译错误

时间:2012-02-16 09:29:49

标签: java java-ee maven maven-2 maven-3

我正在使用Fedora,我的java主页设置为:

export JAVA_HOME=/home/UserName/java

    export M3_HOME=/home/UserName/softwares/apache-maven-3.0.3 
    export PATH=$PATH:/home/UserName/java/bin:/home/Udeshika/softwares/apache-maven-3.0.3/bin

现在,当我尝试为maven项目运行mvn install时,我收到了以下错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project viewer: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] /home/UserName/java/jre/../lib/tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.
[ERROR] -> [Help 1]
[ERROR] 

如果我查看我的maven版本

Apache Maven 3.0.3 (r1075438; 2011-02-28 23:01:09+0530)
Maven home: /home/UserName/softwares/apache-maven-3.0.3
Java version: 1.6.0_07, vendor: Sun Microsystems Inc.
Java home: /home/UserName/java/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.34.9-69.fc13.i686.pae", arch: "i386", family: "unix"

maven告诉我的JAVA_HOME是

  

Java home:/ home / UserName / java / jre

我想我已经确定了现在我不知道要解决的问题,任何人都可以指导我解决这个问题吗?

提前谢谢

1 个答案:

答案 0 :(得分:1)

您需要拥有Java SDK才能使用Maven。 SDK包含tools.jar并允许您编译,而JRE只是一个运行时。