Changing the java.home path in VS code
22,861
Solution 1
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",
Solution 2
The path to the Java Development Kit is searched in the following order:
- the java.home setting in VS Code settings (workspace then user settings)
- the JDK_HOME environment variable
- the JAVA_HOME environment variable
- 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'.
Author by
Ravikiran Talawar
Updated on February 03, 2022Comments
-
Ravikiran Talawar over 2 years
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.
-
nbokmans almost 4 yearsEnvironment variables, more specifically the
PATH
variable. -
Ravikiran Talawar almost 4 years@nbokmans yes I've changed it there, Here's output from cmd C:\Users\Lenovo>echo %PATH% ...C:\Program Files\Java\jdk-14.0.2\bin;e:\anconda;e:\anconda\Library\mingw-w64\bin;e:\anconda\Library\usr\bin;e:\anconda\Library\bin;e:\anconda\Scripts;C:\Users\Lenovo\AppData\Local\Microsoft\WindowsApps;C:\Users\Lenovo\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Lenovo\AppData\Roaming\npm;F:\PyCharm Community Edition 2019.3.1\bin;
-
-
Farhad over 2 yearsit says it's deprecated, any update on the new way ?
-
TDiblik about 2 yearsHi, thanks for info, however I was unable to find a reason for this change. Could you please provide more info?