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):
- Went to my software manager, searched for JDK 11.
- Deleted JDK 11 and installed JDK 17 from the software manager
- Went to VSC and installed an extension "java run".
- Ran the code and it worked just fine.