关闭

解决Perhaps you are running on a JRE rather than a JDK?问题

15680人阅读 评论(0) 收藏 举报
分类:

转自:http://www.bubuko.com/infodetail-743907.html

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

技术分享


[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ helloworld ---
[INFO] Deleting H:\mavenok\helloworld\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ helloworld ---
[INFO] Using ‘UTF-8‘ encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory H:\mavenok\helloworld\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ helloworld ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to H:\mavenok\helloworld\target\classes
[INFO] -------------------------------------------------------------
[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: 0.781 s
[INFO] Finished at: 2015-03-25T11:22:14+08:00
[INFO] Final Memory: 4M/8M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project helloworld: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException


问题描述:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

翻译过来就是,大哥,环境里没给编译器呀,可能你是用jre在玩耍,我要jdk~~


问题原因:eclipse官网看了看,发现eclipse默认是运行在jre上的,
但是maven插件需要使用jdk,因此需要在eclipse修改Installed JRES
位置在-->【Window】-->【Prefrences】-->【Java】-->【Installed JREs】
详见下图。


技术分享


这样就解决了这个问题,重新构建一下


[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ helloworld ---
[INFO] Deleting H:\mavenok\helloworld\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ helloworld ---
[INFO] Using ‘UTF-8‘ encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory H:\mavenok\helloworld\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ helloworld ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to H:\mavenok\helloworld\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.117 s
[INFO] Finished at: 2015-03-25T11:45:51+08:00
[INFO] Final Memory: 6M/12M
[INFO] ------------------------------------------------------------------------


构建成功。

技术分享



安装Maven后,提示“Eclipse is running in a JRE, but a JDK is required”的解决方法


参考自:http://www.cnblogs.com/shenshuyi/archive/2012/10/17/2727815.html

对于m2eclipse的插件,需要eclipse运行于jdk而不是jre, 打开eclipse,看到错误“Eclipse is running in a JRE, but a JDK is required”

解决方法:

在eclipse目录下eclipse.ini,添加如下两行,注意这行要加在-vmargs之前,

-vm 
D:\Program Files\Java\jdk1.7.0_07\bin\javaw.exe

比如我的文件如下:

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm 
D:\Program Files\Java\jdk1.7.0_07\bin\javaw.exe 
-vmargs
-Xms40m
-Xmx512m


执行了Run as-run configrations


发现这个里面的runtime jre竟然还是设置在Alternate JRE上面,把它设置到Workspace default JRE上就可以了。
0
0
查看评论

Eclipse中运行Maven打包编译时出现:Perhaps you are running on a JRE rather than a JDK?

出现错误后,查看了许多网友的解决方式,但都没有解决我遇到的问题,可能是情况还是有些许的不同;下面直接说说我的问题的解决办法,希望对大家有所帮助;Eclipse中Maven报错信息如下: 本以为可能是Eclipse配置Maven没配置好,或者是jdk和jre环境出现问题,后来在cmd窗口找到ma...
  • raymond27
  • raymond27
  • 2017-02-10 09:56
  • 5054

解决maven项目install之后报出Perhaps you are running on a JRE rather than a JDK?错误

不管在什么地方,什么时候,学习是快速提升自己的能力的一种体现!!!!!!!!!!! 前几天安装了新的eclipse,今天创建了一个maven项目测试下自己写的代码,结果 在install的时候报出了  No compiler is provided in this environmen...
  • hui_2016
  • hui_2016
  • 2017-04-19 11:46
  • 1530

解决Perhaps you are running on a JRE rather than a JDK?问题

转自:http://www.bubuko.com/infodetail-743907.html Maven-No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?...
  • hjwang1
  • hjwang1
  • 2015-11-28 17:57
  • 15680

解决Perhaps you are running on a JRE rather than a JDK?问题

Maven-No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [INFO] Scanning for projects... [INFO]
  • lxlhu
  • lxlhu
  • 2015-04-15 11:50
  • 5230

Perhaps you are running on a JRE rather than a JDK?

eclipse菜单 - Window - Preferences- Java - Installed JREs 选择edit,将配置的JRE定位到JDK,修改JRE home。
  • lxg2015
  • lxg2015
  • 2017-04-24 08:19
  • 842

Maven报错Please ensure you are using JDK 1.4 or above and not a JRE解决方法

在eclipse下用maven编译时,可能报以下提示  Please ensure you are using JDK 1.4 or above and not a JRE (the com.sun.tools.javac.Main class is required).  原因...
  • u011851478
  • u011851478
  • 2016-06-26 11:24
  • 6835

maven:Perhaps you are running on a JRE rather than a JDK

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project paybuss-service-api: Compilatio...
  • HaiPaner
  • HaiPaner
  • 2015-01-31 19:01
  • 1365

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:testCompile (default-testCompile) on project...
  • fox_lht
  • fox_lht
  • 2013-11-17 13:21
  • 86809

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

控制台输出的错误信息如下:[INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreade...
  • testcs_dn
  • testcs_dn
  • 2015-01-21 20:29
  • 19484

Maven项目出现Perhaps you are running on a JRE rather than a JDK?

1、今天在使用springboot进行clean和package出现了错误,maven的错误如下:Failed to execute goal org.apache.maven.plugins:maven-compiler- plugin:3.1:compile (default-compile...
  • two_people
  • two_people
  • 2017-04-20 11:30
  • 1323
    个人资料
    • 访问:554448次
    • 积分:7257
    • 等级:
    • 排名:第3671名
    • 原创:75篇
    • 转载:538篇
    • 译文:1篇
    • 评论:91条
    最新评论