我目前正在尝试使用其他Java版本进行测试。但是我无法在VS代码中显示新添加的Java版本。我在我的设置中添加了它。
但是它在“项目配置运行时”菜单上没有显示为可选版本:
如您所见,仅在下拉列表中列出了JDK 17,而不是JDK 14。我做错了什么吗?
PS:
“重新安装” Java版本是不是的选项,因为它是下载的zip文件,并且该版本没有安装程序出口。
编辑:
我想做的方式也是在他们的 github page < /a>。
更新:
在尝试一些事情时,我从环境变量中删除了所有Javaisch。现在,上面的下拉列表中没有JDK列出。但是VS代码仍然以某种方式找到了我的JDK-17并运行Java程序。当我将JDK-14设置为“ Java_home” VS代码时,请使用JDK-14版本。但这不是我的目标。我希望可以在VS代码中选择多个Java版本(菜单是为设计的),它是行不通的。
I'm currently trying to use a different java version for testing purposes. But I can't get the newly added java version show up in VS Code. I added it in my settings.json like this:

But it doesn't show up as a selectable version on the "Configure Runtime for Projects" menu:

As you can see only jdk 17 is listed in the dropdown, not the jdk 14. Am I doing something wrong?
PS:
"Reinstalling" the Java version is not an option because it's an downloaded zip file and no installer exitst for this version.
EDIT:
The way I'm trying to do is also recomended on their github page.
UPDATE:
While trying some things I removed everything Javaisch from my environment variables. Now no JDK is listed in the drop down above. But VS Code still somehow finds my JDK-17 and runs Java programs. When I set JDK-14 as "JAVA_HOME" VS Code uses the JDK-14 version. But this is not my goal. I want multiple Java versions selectable in VS Code (which the menus are designed for) it just doesn't work.
发布评论
评论(2)
这在我的机器上正常工作,该机器最初只有 java17 ,现在可以在 java14 和 java8 之间进行选择。
So make sure you have correctly installed Java14, otherwise it won't show up in the dropdown options.
Method 1: Install other versions of Java through the Configure Java Runtime panel
Method 2: Download the Java version on the Internet and install it.
我在此处下载并安装了Java14:
PS: I restore all settings to default or reinstall vscode without any settings.它识别所有三个版本的Java。
This works fine on my machine, which originally only had Java17, now it can choose between Java14 and Java8.
So make sure you have correctly installed Java14, otherwise it won't show up in the dropdown options.
Method 1: Install other versions of Java through the Configure Java Runtime panel
Method 2: Download the Java version on the Internet and install it.
I downloaded and installed Java14 here: java14
PS: I restore all settings to default or reinstall vscode without any settings. It recognizes all three versions of Java.
截至2023年,jdks添加到设置中。
如果您想解决此问题,请加入以下问题。
相关答案:
如何与vscode和多个Java版本一起工作/a>
As of 2023, JDKs added to settings.json do not appear in the dropdown.
If you would like to resolve this issue, please join the following Issue.
https://github.com/microsoft/vscode-java-pack/issues/1260
Related answer:
How to work with VSCode and multiple java versions