您的位置:首页 > 其它

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

2017-02-06 16:58 525 查看
我在学习maven时遇到了这个报错,找到了这位外国友人写的博客。

http://www.kriblog.com/ide/sts/error-no-compiler-is-provided-in-this-environment.-perhaps-you-are-running-on-a-jre-rather-than-a-jdk.html

他提供了三种方法:

第一个修改jre的我自己试过好像没用;

第二个据说是最好的方法然而我还没接触Spring,因而作罢;

第三个亲自试验确实可行,然而却不能一劳永逸。

也希望有高手能来指点迷津。。

对我来说今天真是糟糕的一天,我花了许多时间下载最新的 Spring Tool Suite based on Eclipse 4.4.1 压缩版,但是现在出现了下面的错误。

[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: 18.162 s
[INFO] Finished at: 2014-12-30T02:13:56+05:30
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project demo: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]


有人知道这个问题吗?先提前感谢一下。

提问自Navdeep于2014-12-16 09:36:03.0

你可以选择以下任意方式解决[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

方法1

点击 Windows -> Preferences -> Java -> Installed JREs -> Add -> Standard VM, 然后选择JAVA_HOME



从已经安装的JRE中选择新的JRE并点击OK



方法2

最简单并且在所有场景中都适用

第一步-打开Spring Tool Suite(STS)的安装目录

第二步-右击STS.ini

第三步-打开 -VM JAVA_HOME/bin/javaw.exe然后重启Eclipse Spring Tool Suite (STS),Eclipse将会自动获得这个JDK

-vm
G:/jdk1.7.0_25/bin/javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20140603-1326
-product
org.springsource.sts.ide
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx768m
-XX:MaxPermSize=256m
-Dorg.eclipse.swt.browser.IEVersion=10001


方法3

打开pom.xml,输入以下高亮部分并将正确的JDK路径输入。(不支持部分高亮,start至end部分)

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--start-->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<fork>true</fork>
<executable>
D:\jdk1.7.0_25\bin\javac.exe
</executable>
</configuration>
</plugin>
<!--end-->
</plugins>
</build>


祝你好运!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  maven
相关文章推荐