• m2e (maven eclipse) 在运行一些命令时出现了无法compile(Unable to locate the Javac Compiler in:)


    出现的bug提示

    Unable to locate the Javac Compiler in:
    C:\Program Files\Java\jre1.6.0_07\..\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.

    从上面的Please ensure you are using JDK 1.4 or above and
    not a JRE (the com.sun.tools.javac.Main class is required)

    可以看出m2e要求用于编译应该要用jdk且jdk是1.4及以上的版本才行

    我在命令行下echo %JAVA_HOME%

    检查了一下我的"JAVA_HOME"是C:\Program Files\Java\jdk1.6.0_20

    那是哪里出错了呢,,这时我意识到我用的是m2e,那么我的运行时环境应该就是根据

    eclipse(eclipse也有默认也有自己的运行时环境)指定的才是,,那么我只要把修改eclipse指定的运行时环境路径不就可以了,

    于是

    1、在eclipse里面修改 "window-->preferences->java->installed jres" 如图:

    edit the selected jre or add a new jre and select it  

    the location should be "C:\Program Files\Java\jdk1.6.0_20\jre"

    please don't close the "Edit JRE" dialog ,continue the second step.

    2、remove the default jre system libraries and add all the jar in  the lib folder, lib subdirectory in  %JAVA_HOME%/jdk**/jre/

    illustration:

    _^^_.......I wish this bug report message will help u....and please comment this ...

     

     

     

     

    在用maven的这些日子以来,发现还有一种可能出现这种错误,就是你已经install了你的项目,,这时出现这种bug时,你需到仓库去把这些已存在的版本删除即可

  • 相关阅读:
    mac添加环境变量
    Flex 中文字体终极解决方案
    C# Label背景透明
    C# 字节数组和十六进制字符串之间转换的另类写法
    C# params 动态参数
    HttpFlexSession注册失败的怪问题
    sun.misc.BASE64Encoder找不到jar包的解决方法
    Eclipse jee 3.7常用插件安装手记
    GitHub安装缓慢甚至下载失败的解决办法
    subclipse解决JavaHL不可用的问题
  • 原文地址:https://www.cnblogs.com/silentjesse/p/2727407.html
Copyright © 2020-2023  润新知