Home > database >  Visual Studio Code not detecting java 17 installed even though java 17 was installed via a link gott
Visual Studio Code not detecting java 17 installed even though java 17 was installed via a link gott

Time:12-07

So I recently installed OpenJDK 17 for Linux and it came to me as a tar.gz file. I installed it after clicking a link I got on vs code after installing a java extension pack (I had Java 11 installed by default, but I decided to get the latest version), under the adoptium's temurin tab of installing Java from vsc. So after doing so I reloaded the screen, but still no change. Vs code is still not detecting java 17 or 11 is installed. Also when I type java --version in the terminal, I get :

OpenJDK 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11 9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11 9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

How do I make Java 17 the default version for VSC?

CodePudding user response:

You've added jDK11 to PATH, discard this configuration then add jdk17 to PATH.

Then turn to VS Code, open User Settings.json and add

"java.home": "<path to jdk17>",

Then reload window to make this change effective.

CodePudding user response:

I did the following steps to fix the issue(I use Debian based Linux OS):

  1. Went to my software manager, searched for JDK 11.
  2. Deleted JDK 11 and installed JDK 17 from the software manager
  3. Went to VSC and installed an extension "java run".
  4. Ran the code and it worked just fine.
  • Related