mvn compile - [ERROR]此环境中未提供编译器。也许您运行的是JRE而不是JDK?

时间:2017-02-24 11:14:22

标签: java maven

我从命令行运行mvn compile并得到了这个:

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:12 min
[INFO] Finished at: 2017-02-24T10:19:32+00:00
[INFO] Final Memory: 24M/247M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project spring-boot-sam
ple-atmosphere: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

我已经看到了这个答案,但它适用于Eclipse。

任何建议

2 个答案:

答案 0 :(得分:1)

将JDK而不是JRE设置为环境(必要时下载)

JDK = JRE + Codingstuff(包括编译器)

答案 1 :(得分:0)

你需要更新环境变量(在ENV变量中给出JDK路径)  这里link如何设置