0

enter image description here

Does VS Code (code-runner extension) support JDK 1.8? In the morning I was using JDK 12 , but then I downgraded to JDK 1.8 to try out applet viewer and stuff. Unfortunately now it doesn't even highlight the code.

Someone please tell me the problem and its solution.

Gama11
  • 31,714
  • 9
  • 78
  • 100

4 Answers4

5

JDK 1.8 is supported by VSCode.

Read https://code.visualstudio.com/docs/languages/java and install needed extensions.

Update 2021

Currently to use the Java extension in VSCode its required JDK 11, but you can still use older versions of JDK in your projects. See this to get information about how to configure other JDK version for your project.

un0tec
  • 170
  • 1
  • 11
  • Where do i go from here ? –  May 25 '19 at 19:38
  • @KaustavGhosh Official vscode documentation for java support. – un0tec May 25 '19 at 20:24
  • I think VSCode support for JDK 1.8 is going away soon. On the latest VSCode update, it popped up a message to me that said that was the case. – djangofan Apr 23 '20 at 19:54
  • @djangofan could you specify the version you are talking about? ty – un0tec May 04 '20 at 10:31
  • Since i got that error, my VSCode updated 2x since then, so I don't know the exact version number when I saw that. I saw the message during or right after i did a vscode program update. – djangofan May 13 '20 at 23:16
5

Java 1.8 was no longer supported since "Language support for Java" extension upgrade to 0.68.0, I downgraded to 0.64.1 which works for me.

suwen
  • 59
  • 1
  • 2
1

As stated here:

Note: Although the Java language server requires JDK version 11 or above to run, this is NOT a requirement to your project's runtime.

This means that you need to have JDK 11 or higher installed. You can also install older JDKs and configure the runtimes. Just open the Command Palette (Ctrl+Shift+P) and type the command Java: Configure Java Runtime. If you have JDK 8 installed and have properly configured maven or gradle, this isn't even necessary. Visual Studio Code will correctly pick up the correct JDK.

kgiannakakis
  • 103,016
  • 27
  • 158
  • 194
0

VS Code no longer supports JDK 1.8. The "Java Extension Pack" relies upon "Language Support for Java(TM) by Red Hat" which documents Java 11 is the minimum requirement. See here: https://marketplace.visualstudio.com/items?itemName=redhat.java

Tis unfortunate, guess I'm switching back to eclipse

Galen Howlett
  • 530
  • 4
  • 12