Visual Studio Code showing “Java 11 or more recent is required to run. Please download and install a recent JDK”

We Are Going To Discuss About Visual Studio Code showing “Java 11 or more recent is required to run. Please download and install a recent JDK”. So lets Start this Java Article.

Visual Studio Code showing “Java 11 or more recent is required to run. Please download and install a recent JDK”

  1. Visual Studio Code showing “Java 11 or more recent is required to run. Please download and install a recent JDK”

    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.

  2. “Java 11 or more recent is required to run. Please download and install a recent JDK”

    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.

Solution 1

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.

Original Author Of This Content

Solution 2

For future readers. If you are using the extension “Spring Boot Tools” you may get a similar error to this. I had my JAVA_HOME set to java 8 but required java 11 to use the Spring Boot Tools Language Server. It seems that Spring Boot Tools uses whatever your JAVA_HOME environment variable is or in the PATH environment variable, Spring Project Issue. To override your JAVA_HOME variable you’ll need to modify the spring-boot.ls.java.home setting.

  1. Open Visual Studio Code
  2. CRTL + , to open the settings
  3. Search spring-boot.ls.java.home
  4. Select ‘Edit in settings.json’
  5. Your Java 11 installation → "spring-boot.ls.java.home": "C:\\Program Files\\Java\\jdk-11.0.10"
  6. Save and restart VS Code

Prereq: Have a Java 11 installation

Original Author Of This Content

Solution 3

Not recommended workaround (not future-proof):

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. If you can, use the accepted answer of this thread instead.).

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):

Enter image description here

Please mind:

This should be relevant only for those who cannot install JDK 11 or higher:

  • Due to a 32-bit system (and who by the same time are forced to use an Oracle JDK 8 as their last Oracle version for 32 bit, so that they are not allowed to use the recommended OpenJDK 14 – see JDK Requirements → click at the top at the Java Development Kit link → jump to https://adoptopenjdk.net/)
  • Due to restrictions on a 64-bit system:
    • One plausible reason is that you are not allowed to update Gradle and you have a Gradle version below 4.7, see the github discussion again.
    • One “not that plausible” restriction could be some efficient laziness. You might simply not want to install a new JDK and change the Visual Studio Code settings back to your old JDK only because of a version change of the Java extension :).

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.

Original Author Of This Content

Solution 4

In Windows,

  1. Download and install JDK 11.

Download and install JDK 11

  1. Once the installation is complete, in C:\Program Files\Java you’ll see something like this

C:\Program Files\Java

As you can see, we have JDK 11 in C:/Program Files/Java/jdk-11.0.8.

  1. Open VSC and go to Settings (CTRL + , or Manage icon (bottom left) > Settings) and search for javahome

VSC Settings Java Home

  1. Click in “Edit in settings.json”, add C://Program Files//Java//jdk-11.0.8 to java.home and save the file. You should have something like this

Java Home VS Code Settings

{
    "java.home": "C://Program Files//Java//jdk-11.0.8"
}
  1. Restart VS Code and you’ll see something like this

Security Warning

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.

Original Author Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment