2012-02-16 291 views
0

我的工作的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 

現在,當我嘗試運行mvn install Maven的項目,我收到以下錯誤

[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" 

這裏行家告訴我的JAVA_HOME是

Java主:/家庭/用戶名/ JAVA/JRE

我想我現在已經確定的問題,我不知道解決這個問題任何人都可以引導我解決這個問題?

預先感謝您

+2

我解決了它,首先我只安裝了jre,安裝jdk後沒有安裝jdk,問題消失 – 123Ex 2012-02-16 10:17:27

回答

1

您需要有一個Java SDK才能使用Maven。 SDK包含tools.jar並允許您編譯,而JRE僅僅是一個運行時。

+0

是的你是對的我解決了安裝java sdk – 123Ex 2012-02-18 23:41:42