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

2023-05-16

运行maven时报错如下

[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------------< cn.test:MavenTest >--------------------------
[INFO] Building MavenTest 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MavenTest ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ MavenTest ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\java\EclipseTest\MavenTest\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?
此环境中不提供编译器。也许您运行的是jre而不是jdk?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.810 s
[INFO] Finished at: 2019-10-19T16:00:15+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project MavenTest: 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

JDK和JRE有如下区别:

相同点:

都可以运行JAVA程序,JDK中包含JRE,JRE本身就是Java运行环境。

不同点:

JDK全称为"JAVA 开发工具包",JRE全称为"JAVA运行环境":

JRE是java runtime environment(java运行环境)的缩写。光有JVM还不能让class文件执行,因为在解释class的时候JVM需要调用解释所需要的类库lib。在JDK的安装目录里你可以找到jre目录,

里面有两个文件夹bin和lib,在这里可以认为bin里的就是jvm,lib中则是jvm工作所需要的类库,而jvm合lib合起来就称为jre。所以,当你写完java程序,也就.java文件时,当其编译成.class文件后,你可以 把这个.class文件和jre发给朋友,这样你的朋友就可以运行你写的程序了(jre中有运行.class的java.exe)。

结局方案

eclipse的Installed JREs 时add jdk,别add jre,然后重新编译运行

[INFO] Scanning for projects…
[INFO]
[INFO] -------------------------< cn.test:MavenTest >--------------------------
[INFO] Building MavenTest 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ MavenTest —
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ MavenTest —
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ MavenTest —
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ MavenTest —
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\java\EclipseTest\MavenTest\target\test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /E:/java/EclipseTest/MavenTest/src/test/java/TestMethend.java:[1,24] 程序包org.junit不存在
[ERROR] /E:/java/EclipseTest/MavenTest/src/test/java/TestMethend.java:[1,1] 仅从类和接口静态导入
[ERROR] /E:/java/EclipseTest/MavenTest/src/test/java/TestMethend.java:[3,17] 程序包org.junit不存在
[ERROR] /E:/java/EclipseTest/MavenTest/src/test/java/TestMethend.java:[10,10] 找不到符号
符号: 类 Test
位置: 类 TestMethend
[ERROR] /E:/java/EclipseTest/MavenTest/src/test/java/TestMethend.java:[12,17] 找不到符号
符号: 方法 assertEquals(boolean,boolean)
位置: 类 TestMethend
[INFO] 5 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.345 s
[INFO] Finished at: 2019-10-19T16:22:52+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project MavenTest: Compilation failure: Compilation failure:
[ERROR] /E:/java/EclipseTest/MavenTest/src/test/java/TestMethend.java:[1,24] 程序包org.junit不存在
[ERROR] /E:/java/EclipseTest/MavenTest/src/test/java/TestMethend.java:[1,1] 仅从类和接口静态导入
[ERROR] /E:/java/EclipseTest/MavenTest/src/test/java/TestMethend.java:[3,17] 程序包org.junit不存在
[ERROR] /E:/java/EclipseTest/MavenTest/src/test/java/TestMethend.java:[10,10] 找不到符号
[ERROR] 符号: 类 Test
[ERROR] 位置: 类 TestMethend
[ERROR] /E:/java/EclipseTest/MavenTest/src/test/java/TestMethend.java:[12,17] 找不到符号
[ERROR] 符号: 方法 assertEquals(boolean,boolean)
[ERROR] 位置: 类 TestMethend
[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

maven工程中警告[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!

[警告]使用时平台编码格式(GBK actually)进行解析的文件资源,也就是说,构建是依赖于平台的!

错误原因:一些源文件的编码格式并不是工具平台的默认的解析格式,二者有冲突,所以报错
解决方法:在maven工程中的父工程POM中加入以下代码“

再次运行时就不会报错。

[INFO] Scanning for projects…
[INFO]
[INFO] -------------------------< cn.test:MavenTest >--------------------------
[INFO] Building MavenTest 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ MavenTest —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ MavenTest —
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ MavenTest —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] — maven-compiler-plugin:3.1:testCompile (default-testCompile) @ MavenTest —
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] — maven-surefire-plugin:2.12.4:test (default-test) @ MavenTest —
[INFO] Surefire report directory: E:\java\EclipseTest\MavenTest\target\surefire-reports
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit3/2.12.4/surefire-junit3-2.12.4.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit3/2.12.4/surefire-junit3-2.12.4.pom (1.7 kB at 651 B/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.12.4/surefire-providers-2.12.4.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.12.4/surefire-providers-2.12.4.pom (2.3 kB at 5.0 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit3/2.12.4/surefire-junit3-2.12.4.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit3/2.12.4/surefire-junit3-2.12.4.jar (26 kB at 16 kB/s)


T E S T S

Running TestMethend
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.367 s
[INFO] Finished at: 2019-10-19T16:27:54+08:00
[INFO] ------------------------------------------------------------------------

真是不容易搞了一下午卧槽!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 的相关文章

  • 为什么我们可以使用“this”作为实例方法参数?

    什么是接收器参数在爪哇 Java 8 语言规范谈论this JLS 给出a hint http docs oracle com javase specs jls se8 html jls 8 html jls 8 4 1 220 无论哪种方
  • 相当于“evalin”,不需要输出参数(内部)

    背景 我正在阅读有关访问隐藏函数的内容 并开始使用builtin 我写了一个小函数 function klear x go to parent environment evalin base builtin clear x end 这会引发
  • 将环境变量传递给 Angular2 应用程序?

    我需要将后端 url 传递到我的 Angular2 应用程序 因为生产服务器和开发服务器托管在不同的位置 我知道我可以将这些东西存储在外部 config json 中并在启动时加载 然而 在应用程序启动之前 这似乎是不必要的对服务器的额外调
  • 如何在无环境的Ruby脚本中指定rubygems路径?

    我用 Ruby 为 Cacti 编写了一个数据收集脚本 它在命令行中运行良好butCacti 通过 env i 运行脚本 该脚本会剥离环境 因此 Ruby 无法找到 ruby gems 库 在 require 中 没有要加载的文件 ruby
  • 匿名函数的上下文是什么?

    我有这样的代码 function demo this val 5 function this val 7 现在 当我在 Firefox 或 Chrome 控制台中执行此代码时 它会出现语法错误 我不明白为什么这是一个错误 因为我读过 jav
  • 如何从 Jenkins 2.0 管道脚本读取属性文件

    我正在尝试编写一个管道脚本与 Jenkins 2 0 一起使用来复制我们现有的构建 这个原始构建使用 envInject 插件来读取 Java 属性文件 但我看不到如何从管道 Groovy 脚本中执行此操作 我用 Google 搜索并找到了
  • dll 的环境变量与 exe 的环境变量不同

    我正在调试一个 64 位应用程序 其中 c exe 使用本机 c dll 在 Windows 7 上 这两个应用程序的环境变量似乎不同 即使它们都在同一进程中执行 调用 System Environment SetEnvironmentVa
  • 如何在 React 上正确地将 onclick 处理程序绑定到 `this`

    解释为什么这不是重复的 我的代码已经可以工作 我已将其作为评论包含在内 问题是为什么this当我将其包含到单击处理程序函数时 上下文会发生变化 我正在尝试 React 中的计算器项目 目标是将 onclick 处理程序附加到数字按钮 以便数
  • Jquery - 悬停时将图像高度和宽度扩展 20%

    晚上好 动态访问图像高度和宽度的最佳方法是什么 我想在图像宽度和高度上添加 20 并在周围的 div 悬停时设置动画 我想我需要使用 this 但不确定如何访问图像 非常感谢任何帮助 干杯保罗 你可以做这样的事情 使用 height htt
  • Ruby、Unicorn 和环境变量

    在使用 Heroku 时 我发现他们使用环境变量进行服务器本地配置的方法非常出色 现在 在设置自己的应用程序服务器时 我发现自己想知道复制它有多困难 我正在部署一个 sinatra 应用程序 使用 Unicorn 和 Nginx 我知道ng
  • 在R6RS方案中,有没有办法获取当前环境以供eval使用?

    R6RS方案中有没有办法获取当前环境 然后将其作为第二个参数传递给eval 例如 下面的表达式要返回 9 问号应该是什么 let x 4 y 5 eval x y 不 R6RS中没有这样的东西 一些罕见的实现可能支持类似的东西 但绝大多数
  • 如何使用attachEvent引用调用者对象(“t​​his”)

    使用方法 attachEvent 在 IE 中 如何引用调用者对象 触发事件的元素 this In normal浏览器 使用 addEventListener 变量this指向元素 而在 IE 中它指向window object 我需要它与
  • 将参数传递给函数以使用 ggplot stat_function 进行绘图

    我有一个函数和一个参数列表 F lt function a b a b b a L lt list a 5 b 2 c 0 我想用未知的 x 或 x 替换参数之一 a b 或 c 并使用 ggplot 的 stat function 进行绘
  • 在模板化派生类中,为什么需要在成员函数内使用“this->”限定基类成员名称?

    当我调查 Qt 的源代码时 我发现 trolltech 的人明确使用this关键字来访问析构函数上的字段 inline QScopedPointer T oldD this gt d Cleanup cleanup oldD this gt
  • $this 关键字的含义是什么?

    请解释一下这是为了什么 this and gt 代表 让我们以下面的代码为例 this gt convertNamesToCaptions order formId this 指的是当前对象 手册说 当从对象上下文中调用方法时 伪变量 th
  • conda 内部是如何工作的?

    我搜索了一段时间但找不到满意的答案 康达 http conda pydata org http conda pydata org 在内部工作 任何细节欢迎 此外 由于它与 python 无关并且显然工作得如此良好和流畅 为什么它不被用作像
  • Monodroid 环境变量

    在 Android 中 Android OS Environment 提供了一组可用的环境路径 但是 当考虑到跨平台功能时 我想将图片存储在图片文件夹中 因此考虑使用 System Environment GetFolderPath 然而
  • 在 Eclipse (Spring Source) 中,Grails 始终以生产模式构建

    当在 Grails 项目中使用 Eclipse 时 战争的构建似乎陷入了生产模式 如果您想部署到附加的 tcServer 您只需右键单击您的项目 然后选择 运行方式 gt 在服务器上运行 如果您将 grails 项目设置为 dev 右键单击
  • PyCharm 虚拟环境和 Anaconda 环境有什么区别?

    当我在 PyCharm 中创建新项目时 它会创建一个新的虚拟环境 我读到 当我执行Python脚本时 它们是使用此环境中的解释器而不是系统环境来执行的 因此 如果我需要安装一些软件包 我只能将它们安装在这个环境中 而不是在系统环境中 这很酷
  • 模板类中的模板函数 is_same

    为什么这段代码会产生错误的输出 this type cpp include

随机推荐

  • test

    1 为什么要有类的继承性 类的继承性可以减少代码冗余度 xff0c 提高代码复用性 xff0c 提高代码操作效率 2 继承的格式 xff08 语法 xff09 子类 extends 父类 3 子类继承父类后有哪些不同 子类范围大于父类 xf
  • Set,list,map

    Set Set集合的特点 xff1a 元素不重复 xff0c 存取无序 xff0c 无下标 Set集合下面有 xff1a HashSet xff0c LinkedHashSet xff0c TreeSet HashSet存储字符串 span
  • String类的final原因

    作者 xff1a 知乎用户 链接 xff1a https www zhihu com question 31345592 answer 114259286 来源 xff1a 知乎 著作权归作者所有 商业转载请联系作者获得授权 xff0c 非
  • Java测试题

    1 Set里的元素是不能重复的 xff0c 那么用什么方法来区分重复与否呢 是用 61 61 还是equals 它们有何区别 它们使用hashcode来区分是否重复 xff0c 首先通过hashcode来判断是否重复 xff0c 如果has
  • Java中Error与Exception的区别

    Error类和Exception类都继承自Throwable类 Error的继承关系 xff1a Exception的继承关系 xff1a 二者的不同之处 xff1a Exception xff1a 1 xff0e 可以是可被控制 chec
  • 技能树,面试要求重点部分

    一 Java技能树 1 基本语法 这包括static final transient等关键字的作用 xff0c foreach循环的原理等等 比如面试的时候面试官问你static关键字有哪些作用 xff0c 如果你答出static修饰变量
  • list,set,map的应用

    list xff0c set xff0c map的应用 1 Set里的元素是不能重复的 xff0c 那么用什么方法来区分重复与否呢 是用 61 61 还是equals 它们有何区别 它们使用hashcode来区分是否重复 xff0c 首先通
  • Java线程多线程

    创建两个线程 xff0c 一个打印1 52 xff0c 一个打印A Z 打印顺序为12A34B56C78D span class token keyword package span Thread span class token punc
  • Java线程test

    1 银行有一个账户有两个储户存分别向同一个账户存3000 元 xff0c 每次存1000 xff0c 存3次 每次存完打印账户余额 问题 xff1a 该程序是否有安全问题 xff0c 如果有 xff0c 如何解决 xff1f 提示 1 xf
  • java daytest

    1 为什么要有类的继承性 类的继承性可以减少代码冗余度 xff0c 提高代码复用性 xff0c 提高代码操作效率 2 继承的格式 xff08 语法 xff09 子类 extends 父类 3 子类继承父类后有哪些不同 子类范围大于父类 xf
  • 【rustdesk】rust入门及 windows 客户端尝试编译

    rustup 微软建议用vs code开发 官方faq 构建rustdesk 大神构建的经验 下载了64位的版本 vs code 插件 rust analyer 介绍 Better TOML 用于更好的展示 toml文件 Error Len
  • Java中创建线程主要有三种方式

    创建线程的方式及实现 Java中创建线程主要有三种方式 xff1a 一 继承Thread类创建线程类 xff08 1 xff09 定义Thread类的子类 xff0c 并重写该类的run方法 xff0c 该run方法的方法体就代表了线程要完
  • javaTest

    一 xff1a 简答题 xff08 5分 xff09 什么是java序列化 xff0c 如何实现java序列化 xff1f 答 xff1a 序列化就是一种用来处理对象流的机制 xff0c 所谓对象流也就是将对象的内容进行流化 可以对流化后的
  • MySQL使用过程中可能出现的错误

    1 mysql下载地址下载地址 xff1a https dev mysql com downloads windows installer 8 0 html 2 更改加密方式 xff1a mysql span class token ope
  • DOM介绍BOM

    DOM介绍 D xff08 文档 xff09 可以理解为整个Web加载的网页文档 xff0c O xff08 对象 xff09 可以理解为类似window对象只来的东西 xff0c 可以调用属性和方法 xff0c 这里我们说的是docume
  • JavaScript基本概念

    本章节介绍了 JavaScript xff0c 并且讨论了它的一些基本概念 你应该已经掌握哪些知识 xff1f 节 我们假设你已经掌握了以下基础技能 xff1a 对互联网和万维网 xff08 WWW xff09 有基本的认识 熟悉超文本标记
  • HTML,CSS,以及基础javaScript

    1 HTML 是一种在 Web 上使用的通用标记语言 HTML 允许你格式化文本 xff0c 添加图片 xff0c 创建链接 输入表单 框架和表格等等 xff0c 并可将之存为文本文件 xff0c 浏览器即可读取和显示 1 1HTML 的关
  • jQuery

    jQuery是一个JavaScript函数库 jQuery是一个轻量级的 34 写的少 xff0c 做的多 34 的JavaScript库 类似于一种框架 jQuery库包含以下功能 xff1a HTML 元素选取HTML 元素操作CSS
  • 欢迎使用Maven编辑器

    Maven安装与配置 一 需要准备的东西 JDK Eclipse Maven程序包 二 下载与安装 前往https maven apache org download cgi下载最新版的Maven程序 xff1a 将文件解压到D Progr
  • No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

    运行maven时报错如下 INFO Scanning for projects INFO INFO lt cn test MavenTest gt INFO Building MavenTest 0 0 1 SNAPSHOT INFO ja