Today Visual Studio Code started showing me a pop-up saying:
Java 11 or more recent is required to run. Please download and install a recent JDK.
One workaround is to downgrade the extension "Language Support for Java(TM) by Red Hat" from the most recent version 0.65.0. back to
vscode-java version 0.64.1.
(This is not recommended unless you have restrictions on the JDK version, it is just possible, see the remarks at the bottom).
Taken from Java 11 or more recent is required to run. Please download and install a recent JDK" #1543, this is how to install the earlier extension version (thanks go to the GitHub user who posted this):
Please mind:
This should be relevant only for those who cannot install JDK 11 or higher:
Java Development Kit
link → jump to https://adoptopenjdk.net/)You should not do this if you have no important restrictions. The most plausible restriction is that you use Windows 32 bit, which should be relevant only for those who have an old netbook lying around.
In the usual case: upgrade, and then you can still go back to using an older Java version by changing the settings according to JDK Requirements:
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."
--> This means you can upgrade the extension, install at least Java 11 (JDK 11), and use the Java runtime of your choice <= your installed Java version.
See detailed instructions for Windows 64bit at "Java 11 or more recent is required to run. Please download and install a recent JDK" #1543.
Change from
"java.home": "/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home"
to
"java.home": "/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home"
and keep the rest of the settings as is.
For people who do not want to install Java 11 and keep using Java 8. You will have to install previous version of extension 'Language Support for Java(TM) by Red Hat redhat.java". The extension version should be 0.64.1 for Java 8.
Please refer the answer in the post below -
Visual Studio Code showing "Java 11 or more recent is required to run. Please download and install a recent JDK"
I was experiencing the same issue and the following change to my setting.json file resolved the issue. Big thanks to this comment on patch notes.
"java.home": "C:/Program Files/AdoptOpenJDK/jdk-11.0.8.10-hotspot",
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "C:/Program Files/Java/jdk1.8.0_211",
"default": true
},
{
"name": "JavaSE-11",
"path": "C:/Program Files/AdoptOpenJDK/jdk-11.0.8.10-hotspot",
}
]
On Fedora 32, I finally got it working by installing java-11-openjdk
java-11-openjdk-devel
and setting this configuration in vscode:
"java.home": "/usr/lib/jvm/jre-11-openjdk",
In Windows,
C:\Program Files\Java
you'll see something like thisAs you can see, we have JDK 11 in C:/Program Files/Java/jdk-11.0.8
.
javahome
C://Program Files//Java//jdk-11.0.8
to java.home and save the file. You should have something like this{
"java.home": "C://Program Files//Java//jdk-11.0.8"
}
Security Warning! Do you allow this workspace to set the java.home variable? java.home: C://Program Files//Java//jdk-11.0.8
Click allow and you're good to go.
Note: If you get this error and are reliant on Java 8, fbricon mentions,
you can still compile your projects with Java 8. JDK11 is only required to run vscode-java.