Maven报错: Unable to locate the Javac Compiler in: D:\Program\java\jre1.7.0_45\..\lib\tools.jar
2016-03-09 12:57
579 查看
使用Eclipse Mars 新建Maven项目,出现以下错误:
注意:主要错误信息在这里,
没有在以上路径中找到 toor.jar , 我查看自己的安装路径发现,jre1.7.0_45的外层目录中没有lib 文件夹,也就无法找到toor.jar包。原来当初安装JDK和JRE的时候,JRE单独安装在了外面。在JRE同一级目录中并没有JDK的lib包。所以找不到toor.jar
然后,在Eclipse中重新配置JRE如下:
修改为这个JRE后,同一级目录下能够lib 包下的toor.jar。 然后再次用Maven编译,通过!
[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building maven_hello 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ maven_hello --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory F:\workspace\workspace_mars\maven_hello\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ maven_hello --- [INFO] Compiling 2 source files to F:\workspace\workspace_mars\maven_hello\target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] Unable to locate the Javac Compiler in: D:\Program\java\jre1.7.0_45\..\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. [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.888s [INFO] Finished at: Wed Mar 09 11:56:53 CST 2016 [INFO] Final Memory: 6M/122M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project maven_hello: Compilation failure [ERROR] Unable to locate the Javac Compiler in: [ERROR] D:\Program\java\jre1.7.0_45\..\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
注意:主要错误信息在这里,
Unable to locate the Javac Compiler in: D:\Program\java\jre1.7.0_45\..\lib\tools.jar
没有在以上路径中找到 toor.jar , 我查看自己的安装路径发现,jre1.7.0_45的外层目录中没有lib 文件夹,也就无法找到toor.jar包。原来当初安装JDK和JRE的时候,JRE单独安装在了外面。在JRE同一级目录中并没有JDK的lib包。所以找不到toor.jar
然后,在Eclipse中重新配置JRE如下:
修改为这个JRE后,同一级目录下能够lib 包下的toor.jar。 然后再次用Maven编译,通过!
相关文章推荐
- maven学习
- maven插件maven-war-plugin的使用
- jenkins------部署项目到jboss eap下
- maven使用经验集
- MyEclipse Web Project转Eclipse Dynamic Web Project
- Windows Clang开发环境备忘
- 傻瓜式用Eclipse连接MySQL数据库
- Eclipse引入jquery报错如何解决
- 让Flex Builder 3.0与Eclipse3.4整合起来
- Eclipse配置Javascript开发环境图文教程
- 使用zend studio for eclipse不能激活代码提示功能的解决办法
- 图解Eclipse j2ee开发环境的搭建过程
- 两种Eclipse部署动态web项目方法
- ext for eclipse插件安装方法
- 解决Fedora14下eclipse进行android开发,ibus提示没有输入窗口的方法详解
- eclipse导入jquery包后报错的解决方法
- Eclipse 格式化代码时不换行与自动换行的实现方法
- Eclipse下jQuery文件报错出现错误提示红叉
- eclipse如何忽略js文件报错(附图)
- eclipse3.2.2 + MyEclipse5.5 + Tomcat5.5.27 配置数据库连接池