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.
I need to use the JDK 8 (working on Apache Beam and that's the last supported version). I have been working on that and haven't had any issues until this came up.
I have read through this article and implemented the points mentioned there.
Here is my workspace settings on Visual Studio Code (I have double-checked the paths)
{ "java.configuration.updateBuildConfiguration": "disabled", "java.home": "/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home", "java.configuration.runtimes": [ { "name": "JavaSE-1.8", "path": "/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home", "default": true }, { "name": "JavaSE-11", "path": "/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home", } ] }
Other helpful information:
➜ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
and
➜ which java /usr/bin/java
This started happening today even though I have been running JDK 8 on Visual Studio Code successfully for a while now. I don't remember updating Visual Studio Code, so I'm not sure as to why this is being displayed now since apparently the pop-up has been displayed since mid-April (asked on the vscode-java Gitter channel).
Configure your project JDK using the VS Code setting "java. configuration. runtimes" found by clicking on the "File->Preferences->Settings" menu item and searching for "java. configuration.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With