Unable to locate the Javac Compiler

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


你可能感兴趣的:(Unable to locate the Javac Compiler)