使用Eclipse Mars 新建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] https://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException [INFO]