简体   繁体   中英

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. 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..

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.

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:

 "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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM