您的位置:首页 > 其它

Maven Error:No compiler is provided in this environment的解决办法

2017-08-04 14:07 507 查看
这两天一直停留在一个问题:

对项目进行run as->maven install就会报错:

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

我明明使用的就是jdk啊...

百度一下,发现都是一个解决办法:

window->preference->java->install JREs:将jre改为jdk

对部分人来说,这个办法有用,但是我改了之后还是老样子,然后又搜到有人说要继续操作:

eclipse.ini添加:

-vm

...\java\jdk\bin\javaw.exe(也就是%JAVA_HOME%\bin\javaw.exe)

并且说要在-vmargs前添加

但是还是没用。

然后搜到stack overflow
https://stackoverflow.com/questions/15220392/maven-package-compilation-error
In Windows 7 - 64 bit, there is a permissions problem which prevents the installer from unpacking the file
C:\Program Files\Java\jdk1.6.xx\lib\tools.jar
into your local. This jar file is what
maven-compiler-plugin
version 3.x uses instead of the usual
javac


Solution:Run, as an administrator, the Java JDK installer! And make sure the
tools.jar
is sitting in the
C:\Program Files\Java\jdk1.6.xx\lib\


In case you are using m2e maven integration plugin, you want to see the file is visible to Eclipse via the following steps inside Eclipse:

Go to Window -> Preferences -> Java -> installed JREs
Select the JDK you are using (C:\Program Files\Java\jdk1.6.xx)
Press Edit to see the list of jars including tools.jar, OW you can add it as Add External JAR
Then configure the maven run through these steps:

Run->Run configurations->Fill in Name, Base directory and Goals.
Then in the same window move to the JRE tab and point to the JDK \jdk1.6.xx\

前边一半部分的内容就解决了这个问题,粗略翻译一下:

在64位win7中,存在一个权限问题,这个问题会阻止安装包将tools.jar安装到你的机子上,maven 3.x版本使用的正是这个jar包而非javac

解决方法:管理员权限运行jdk安装包,确保tools.jar在你的jdk\lib\目录下。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐