解决Java 11 or more recent is required to run the Java extension. Please download and install a recent JDK. 的问题
About the Java 11 requirement
The Eclipse Platform has decided to require Java 11 as the minimum requirement for its September 2020 release. See https://www.eclipse.org/lists/eclipse-pmc/msg03821.html.
Because vscode-java depends on the Eclipse JDT.LS, the same requirement applies to vscode-java but on a more agressive timeline: vscode-java usually consumes JDT.LS builds that depend on bleeding edge JDT features, effectively shipping pre-release versions of Eclipse Platform/JDT. As of July 22nd, 2020, Java 11 is now required for running vscode-java.
Do I need to migrate my projects to Java 11?
NO you don’t! Well you should, be we’re not here to judge. It is still possible to compile/run Java applications from Java 1.5 to 14, provided the proper java.configuration.runtimes are configured in the user’s settings.json.
My Gradle version does not support Java 11
You can set the java.import.gradle.java.home preference to specifically run the Gradle Daemon using a prior version of Java. However, this only works for Gradle >= 4.7.
解决方法
- 卸载旧版本jdk,安装jdk11版本及以上版本
- 安装jdk11版本,进入
setting.json
配置
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "/path/to/jdk-8",
},
{
"name": "JavaSE-11",
"path": "/path/to/jdk-11",
},
{
"name": "JavaSE-14",
"path": "/path/to/jdk-14",
"default": true
},
]