简体   繁体   English

此环境中未提供编译器。 也许您在 JRE 而不是 JDK 上运行? 在视觉工作室代码中

[英]No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? in visual studio code

Below is the configuration in vscode.下面是vscode中的配置。 Although I have configured JDK in vscode, I am still getting the compilation error when I run maven install but maven test is working fine..虽然我已经在 vscode 中配置了 JDK,但当我运行 maven install 但 maven test 工作正常时,我仍然遇到编译错误。

Please advise me how to resolve.请告诉我如何解决。

在此处输入图像描述

You need not configure "maven.terminal.useJavaHome" , it depends on java.home , but java.home is deprecated for now.您无需配置"maven.terminal.useJavaHome" ,它依赖于java.home ,但java.home已弃用。

Official docs :官方文档

If you need to compile your projects against a different JDK version, it's recommended you configure the java.configuration.runtimes property in your user settings, eg:如果您需要针对不同的 JDK 版本编译项目,建议您在用户设置中配置 java.configuration.runtimes 属性,例如:

 "java.configuration.runtimes": [ { "name": "JavaSE-1.8", "path": "/path/to/jdk-8", }, { "name": "JavaSE-11", "path": "/path/to/jdk-11", }, { "name": "JavaSE-18", "path": "/path/to/jdk-18", "default": true }, ]

But it will not modify the Path environment variable in the terminal, it will affect the Java extension, for example, the Run Java button.但不会修改终端中的Path环境变量,会影响Java扩展名,例如Run Java按钮。

And from the picture in your question and your comments, you need to download and install a JDK first and remember to add the bin folder of JDK to the Path environment variable.而且从你问题中的图片和你的评论来看,你需要先下载并安装一个JDK,记得将JDK的bin文件夹添加到Path环境变量中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 此环境中不提供编译器。 也许您在 JRE 而不是 JDK 上运行? - 但是选择了jdk - No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? - but jdk selected Mac os 大苏尔 | 此环境中不提供编译器。 也许您在 JRE 而不是 JDK 上运行? - Mac os Big Sur | No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 此环境中未提供编译器。 也许您在 JRE 而不是 JDK 上运行? - No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? Jenkins Windows slave:此环境不提供编译器。 也许您在 JRE 上运行而不是在 JDK 上运行 - Jenkins Windows slave: No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK mvn clean package error: 此环境没有提供编译器。 也许您在 JRE 而不是 JDK 上运行? - mvn clean package error: No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? jenkins 管道错误 此环境中未提供编译器 也许您在 JRE 上而不是 JDK 上运行 - jenkins pipeline error No compiler is provided in this environment Perhaps you are running on a JRE rather than a JDK 也许您在 JRE 而不是 JDK 上运行? - Perhaps you are running on a JRE rather than a JDK? Eclipse中的Maven项目 - 也许您运行的是JRE而不是JDK - Maven project in Eclipse - Perhaps you are running on JRE rather than JDK Maven 错误:也许您在 JRE 而不是 JDK 上运行? - Maven error :Perhaps you are running on a JRE rather than a JDK? 错误 也许您在 JRE 而不是 JDK 上运行? - Error Perhaps you are running on a JRE rather than a JDK?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM