No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK

转载自本人公众号:自动化测试    不只是技术                                             

创建maven的时候报错,错误如下

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Test: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 
原因:eclipse中配置的java环境的目录,错误,把jdk的目录配置成了jre的目录。
解决方法:eclipse中,按照以下路径,Windows->Preferences,找到Java,点击Add,添加jdk的目录。
 

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK_第1张图片


点击Add之后,点击下图Next
 

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK_第2张图片


点击Directory

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK_第3张图片


点击Directory之后,找到自己的jdk的按照目录,点击确定

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK_第4张图片


选中jdk,点击OK。接下来再创建maven项目则不会报错。

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK_第5张图片


 

推荐阅读:

运行自动化测试demo的前期配置一

人生第二十六个儿童节

转载于:https://my.oschina.net/u/3856069/blog/1825582

你可能感兴趣的:(java,开发工具)