下面介绍eclipse maven操作正常出现的No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 错误的解决办法。
方法/步骤
-
eclipse maven操作右击Run as 都能看到,如图所示
-
maven clean 操作主要目的是清除target目录下以前编译生成的文件及jar包
-
右击-->Run as --> maven build 会弹出一个框,输入compile或install命令都可以,编译项目。通过run 执行命令
-
可能会出现如下错误:
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
-
错误原因是maven编译的需要JDK而不是JRE。
eclipse 导航栏中 【Window】-->【Prefrences】-->【Java】-->【Installed JREs】
-
上一步出现的框里点击添加--->【Standard VM】---> 选择JDK的安装目录确定。
-
7添加JDK路径以后必须把JDK把前面的框 勾上,否则还会出现错误。
-
8再次执行compile 或者 install 指令,编译成功。
END
- 转载原地址https://jingyan.baidu.com/article/6dad5075250734a123e36efa.html,保存后续查看!