请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

Perhaps you are running on a JRE rather than a JDK?

[INFO] — maven-compiler-plugin:3.8.1:compile (default-compile) @ com.kungwanyi.demo —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to G:\JavaProject\SpringCloudAlibaba\com.kungwanyi.demo\target\classes
[INFO] -------------------------------------------------------------
[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: 1.112 s
[INFO] Finished at: 2020-02-26T17:36:21+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project com.kungwanyi.demo: Compil
ation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[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

java -version
java version "1.8.0_231"
Java™ SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot™ 64-Bit Server VM (build 25.231-b11, mixed mode)

mvn -version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
Maven home: D:\apache-maven-3.5.4\bin…
Java version: 1.8.0_231, vendor: Oracle Corporation, runtime: D:\java\jre1.8
Default locale: zh_CN, platform encoding: GBK
OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “windows”

正在回答

2回答

  1. 首先,进到Project Structure

//img1.sycdn.imooc.com//szimg/5e564fc209bb9ec908341248.jpg

2. 检查你的JDK路径是不是正确

//img1.sycdn.imooc.com//szimg/5e564f6709f4328b23201586.jpg

3. 检查你项目是不是选择了正确的JDK

//img1.sycdn.imooc.com//szimg/5e564f7a0902ffab23201586.jpg

4. 执行命令:

//img1.sycdn.imooc.com//szimg/5e56505409bea30120901088.jpg

如果你在IDEA的Terminal里面执行命令,那得保证你操作系统的环境变量正确

0 回复 有任何疑惑可以回复我~
  • 提问者 gongwanyi #1
    非常感谢!
    回复 有任何疑惑可以回复我~ 2020-02-26 19:57:00
大目 2020-02-26 18:29:24

您好,从异常看应该是环境变量配置文件。
帮忙贴一下您的环境变量的配置:
JAVA_HOME
PATH
CLASSPATH
………………………………
用如下命令即可查看     echo %PATH%    以此类推,然后复制或者截图出来。
………………………………
以我的经验,您可能是命中了这个文章里面的问题:https://blog.csdn.net/ainuser/article/details/79182486

0 回复 有任何疑惑可以回复我~
  • 提问者 gongwanyi #1
    我是直接在path这个后边添加jdk的bin路径的,而且控制台能正常输出#java、#javac的结果的。
    
    至于你讲的这个#echo %PATH%,在windows环境下是原样返回。如果在控制台直接输入#path,会有Jdk的路径信息的。
    
    我这个idea版本是2019.2的版本
    回复 有任何疑惑可以回复我~ 2020-02-26 18:46:01
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信