java mvn compile - [错误] 此环境中未提供编译器。也许您在 JRE 而不是 JDK 上运行?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42437232/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 06:38:14  来源:igfitidea点击:

mvn compile - [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

javamaven

提问by Snowcrash

I am running mvn compilefrom the command line and am getting this:

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?

I've seen this answer but it's for Eclipse.

我看过这个答案,但它是针对 Eclipse 的。

Any suggestions

有什么建议

回答by kleopi

Set JDK instead of JRE as environment (download it if necessary)

将 JDK 而不是 JRE 设置为环境(如有必要,请下载)

JDK=JRE+Codingstuff (including a compiler)

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

回答by yugi

you need to update environment variable( give JDK path in ENV variable ) here linkhow to set up

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