【问题标题】:Unable to locate the Javac Compiler in:无法在以下位置找到 Javac 编译器:
【发布时间】:2013-01-22 12:56:56
【问题描述】:

我已经按照下面的指导安装了 OpenJDK。但我仍然不断收到这个错误。我在 bash_profile 中设置了正确的 PATH。

有人可以帮我解决这个问题吗?

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-     plugin:2.3.2:compile (default-compile) on project poker-protocol: Compilation failure
 [ERROR] Unable to locate the Javac Compiler in:
 [ERROR] /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/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] 
 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
 [ERROR] 
 [ERROR] For more information about the errors and possible solutions, please read the following articles:
 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
 [ERROR] 
 [ERROR] After correcting the problems, you can resume the build with the command
 [ERROR]   mvn <goals> -rf :poker-protocol

在我的 bash_profile 我有这个:

 JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre
 export M2_HOME=/usr/local/apache-maven-3.0.4
 export PATH=${M2_HOME}/bin:${PATH}:$JAVA_HOME/bin

谁能帮帮我?

【问题讨论】:

  • source ~/.bash_profile了吗?
  • 我已经按照下面的指导安装了 OpenJDK 不,你没有提到你是如何安装它的。
  • 是的,我有,sudo。仍然不断收到错误。 m0skito,我已经按照这里的指导安装了 openjdk java-1.6.0-openjdk-1.6.0.0.x86_64/
  • /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/lib/tools.jar吗?
  • 不,gliptak。我也尝试搜索它,但没有运气。 “查找:`tools.jar':没有这样的文件或目录” - 怎么办?

标签: java linux centos openjdk


【解决方案1】:

您已经安装了 Java 运行时,但是要开发 Java 应用程序,您需要 JDK,因此您必须安装 OpenJDK 开发包,在您的情况下为 java-1.6.0-openjdk-devel-1.6.0.0.x86_64

【讨论】:

    【解决方案2】:

    不太确定,但就我而言,我是这样设置的:

    export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_11/
    export PATH=$JAVA_HOME/bin:$PATH
    

    我已经在bash.bashrc完成了这项工作

    尝试在提供变量名称之前添加export。我发现的另一件事甚至认为我没有使用openjdk,是tool.jar 不在jre 目录中,而是在jdk 目录下。

    希望这会有所帮助。

    【讨论】:

      【解决方案3】:

      你需要安装java-1.6.0-openjdk-devel安装java-1.6.0-openjdk只是安装JRE。

      【讨论】:

        猜你喜欢
        • 2012-12-19
        • 2012-10-21
        • 2012-09-17
        • 2011-01-14
        • 2014-09-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-01-14
        相关资源
        最近更新 更多