Changing the Java. Home Path in vs Code

Changing the Java. Home Path in vs Code

I just installed java 11 coz VS code was prompting me to update it to java 11 or newer version. After installing java 14, I'm not getting how to change the path to new folder that has java 14. In settings.json file the path can be seen when cursor hovered over java.home variable.

2

2 Answers

For those coming now, in VSCode settings change "java.home" to "java.jdt.ls.java.home"

From

"java.home": "C:\\Program Files\\Java\\jdk-17.0.2"

To

"java.jdt.ls.java.home": "C:\\Program Files\\Java\\jdk-17.0.2",
1

The path to the Java Development Kit is searched in the following order:

  1. the java.home setting in VS Code settings (workspace then user settings)
  2. the JDK_HOME environment variable
  3. the JAVA_HOME environment variable
  4. on the current system path

The 'java.home' has the highest priority, and 'java.home' is different from the system environment variable. Open settings and search 'java.home', you can get the example:

"java.home":"C:\\Program Files\\Java\\jdk1.8.0_161"

It points to 'jdk' folder instead of 'jdkFolder\bin'.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.