-3

enter image description here

I installed and uninstalled jdk-14 and install jdk-13 But vscode recognize JAVA_HOME environment variable as "jdk 14" and this is non-existing path. Also, I set the JAVA_HOME as jdk-13 path and write to .zshrc too.

Although reloading and restarting vscode, vscode still recognize JAVA_HOME as jdk-14 path. Where vscode find $JAVA_HOME variable?? There is never my terminal.

ParkSangJun
  • 1
  • 1
  • 1

2 Answers2

0

File -> Preferences -> Settings

Here search for JAVA_HOME. You should see the below option. enter image description here

Now search for java.home and you will see the value that VSCode has set already

enter image description here

Hope this helps.

A G
  • 297
  • 1
  • 7
  • Umm... but "java.home" in settings.json is also "/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home" and it is right path... – ParkSangJun May 19 '20 at 07:58
  • Can you open `Terminal` in VSCode and `echo $JAVA_HOME`? or `echo %JAVA_HOME%`. What value does that give? It is probably a factor of the environment variables set in the shell from where your VSCode instance starts – A G May 19 '20 at 08:51
0

From the picture you have given out. you have set the jdk path for extension correctly, but you really set the 'JAVA_HOME' system environment as 'jdk 14'.

Could you please tell me the meaning of 'vscode recognize JAVA_HOME environment variable as "jdk 14"'? How do you get 'JAVA_HOME' variable?

The 'java.home' was set for the extensions:This JDK will be used to launch the Java Language Server. And by default, the 'java.home' will be used to compile your projects. from:here. and it really has no relationship to "JAVA_HOME" at all.

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13