Maven Install报错:Perhaps you are running on a JRE rather than a JDK?

今天使用Eclipse导入一个Maven工程时,Maven Install时报错如下:
Maven Install报错:Perhaps you are running on a JRE rather than a JDK?_第1张图片
该错误为:
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

翻译过来就是:此环境中未提供编译器,你可能使用jre运行而不是jdk。

我们知道Eclipse默认在jre上运行,maven install 编译需要jdk中的编译器,而jre中并没有,所以报了这个错,解决办法如下:

1、添加JDK到Eclipse中
Maven Install报错:Perhaps you are running on a JRE rather than a JDK?_第2张图片
Maven Install报错:Perhaps you are running on a JRE rather than a JDK?_第3张图片
Maven Install报错:Perhaps you are running on a JRE rather than a JDK?_第4张图片

Maven Install报错:Perhaps you are running on a JRE rather than a JDK?_第5张图片

2、设置运行时使用JDK
Maven Install报错:Perhaps you are running on a JRE rather than a JDK?_第6张图片
Maven Install报错:Perhaps you are running on a JRE rather than a JDK?_第7张图片

Maven clean一下,然后Install即可。

你可能感兴趣的:(Java,后台)