Unable to locate the Javac Compiler

本文解决了M2Eclipse编译时出现的“Unable to locate the Javac Compiler”错误。通过调整JDK路径及添加外部JAR文件,确保了Eclipse正确识别Java编译器。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

M2Eclipse 编译出现 Unable to locate the Javac Compiler 错误。

创建D:\App\Java\lib目录

D:\App\Java\jdk1.6.0_21\lib\tools.jar  jar 包拷贝到 创建的目录,重新运行。


Unable to locate the Javac Compiler in:
  C:\Program Files\Java\jre6\..\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.
Both JAVA_HOME and eclipse -vm option are set, it occurred after the m2eclipse installed long time ago. Today it raised suddenly. However the error message may be confused. The tools.jar doesn't locate in C:\Program Files\Java\jre6\..\lib\tools.jar. my JDK directory is liked this:
├─jdk1.6.0_17
│  ├─bin
│  ├─demo
........................................
│  ├─jre
│  │  ├─bin
│  │  │  ├─client
│  │  │  ├─new_plugin
│  │  │  └─server
│  │  └─lib
.........................................
│  ├─lib
.........................................
├─jre6
│  ├─bin
│  │  ├─client
│  │  └─new_plugin
│  └─lib
.........................................
└─lib (doesn't exist)
I create the lib and put tools.jar in that jre6/../lib, it works.


文章来自: http://maven.40175.n5.nabble.com/Unable-to-locate-the-Javac-Compiler-Problem-td133804.html



=======================================================================================



新的解决方法:

Eclipse -->  Window --> Preferences --> Java --> Installed JRES  --> 编辑当前JRE   --> Add External JARS,  D:\App\Java\jdk1.7.0_17\lib\tools.jar


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值