Eclipse 使用maven编译时找不到Javac编译器-在以下位置找不到Javac编译器:
使用maven编译时出现编译错误Eclipse 使用maven编译时找不到Javac编译器-在以下位置找不到Javac编译器:,eclipse,maven,compiler-errors,Eclipse,Maven,Compiler Errors,使用maven编译时出现编译错误 [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] Unable to locate the Javac Compiler in: C:\Program Files\Java\jre1.6.0_05\..\lib\tools.jar 所以我设置了JAVA\u HOME环境变量,但没有任何优势。错误似
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Unable to locate the Javac Compiler in:
C:\Program Files\Java\jre1.6.0_05\..\lib\tools.jar
所以我设置了JAVA\u HOME
环境变量,但没有任何优势。错误似乎是maven在jre路径中搜索java编译器,而不是在java\u HOME
是JAVA\u HOME
C:\Program Files\JAVA\jdk1.6.0\u 05
- 安装的JRE是
C:\Program Files\Java\jre1.6.0\u 05
- 我的
变量是:路径
C:\Program Files\PC连接解决方案\;D:\alfrescoplatform\ImageMagick;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\Wbem;C:\Program Files\ImageMagick-6.7.3-Q16;C:\ProgramFiles\Java\jdk1.6.0\U 05\bin
这是我的详细记录
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringMVC Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ SpringMVC ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ SpringMVC ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 2 source files to D:\Learning\spring-workspace\SpringMVC2.5.6\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Unable to locate the Javac Compiler in:
C:\Program Files\Java\jre1.6.0_05\..\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: 2.719s
[INFO] Finished at: Thu Nov 01 17:22:43 MMT 2012
[INFO] Final Memory: 4M/8M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project SpringMVC: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre1.6.0_05\..\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
如果您对此有任何想法,请告诉我。尝试将
vm
参数添加到eclipse.ini
文件中
-vm
C:\Program Files\Java\jdk1.6.0_05\bin\javaw.exe
我遇到了完全相同的问题,尝试了这些解决方案但没有成功:
什么对我有用:
- 单击绿色运行按钮旁边的小向下箭头
- 选择运行配置
- 在JRE选项卡上,选择Alternate JRE,然后选择所需的目标(如果该目标不在列表中,请单击Installed JRE将其添加到中)
你能把
mvn--version
的输出包括进来吗?(在设置JAVA\u HOME
之后,你肯定启动了一个新的命令窗口,对吧?)我只是在eclipse中使用maven插件。