18

I downloaded language support for Java by Red Hat in Microsoft Visual Studio Code, enter image description here

but I got a problem as shown in the above picture.

So I tried to set my JDK path in the settings.json file in VSCode:

"java.home": "C:/ProgramFiles/Java/jdk1.8.0_111"

But the problem is still not solved.

Do you know how to solve this problem?

p.campbell
  • 98,673
  • 67
  • 256
  • 322
구지훈
  • 181
  • 1
  • 1
  • 3

7 Answers7

15

You have to restart VS Code after entering the java.home variable in the settings file.

Alternatively, setting that variable isn't even required. You can remove it from your settings and VS Code will automatically check your user/system environment variables for JDK_HOME and JAVA_HOME.

See "Setting the JDK" at https://marketplace.visualstudio.com/items?itemName=redhat.java

For information on how to set the environment variables, see Environment variables for java installation

Community
  • 1
  • 1
FrederikVH
  • 476
  • 2
  • 8
5

you should change the path to be like this:

"java.home":"C:\\Program Files\\Java\\jdk1.8.0_111"
George
  • 2,860
  • 18
  • 31
Zaher88abd
  • 448
  • 7
  • 20
  • **Edit**: `java_home` to `java.home` and add space between `Program` and `Files`. Couldn't edit it because it is less than 6 characters. – Nora Dec 05 '18 at 08:12
3

My Visual Studio Code is set to use the 32 bit version of JDK

A default java.exe is installed in your %SYSTEMROOT%\System32

Check java version from command line:

java -version

You might need to add your version to PATH:

set PATH=%PATH%;C:\Program Files (x86)\Java\jdk1.8.0_111\bin

And set your system JAVA_HOME:

setx -m JAVA_HOME "C:\Program Files (x86)\Java\jdk1.8.0_111"

Restart cmd and try:

echo %JAVA_HOME%

Restart Visual Studio Code and be happy.

Use set instead of setx for local user.

profimedica
  • 2,716
  • 31
  • 41
2

try to change path as follow:

"java.home":"C:/Program Files/Java/jdk1.8.0_202"

Make attention to the space in "Program Files" in the path.

1

If you are using bash from VSCode, should use:

export JAVA_HOME=/c/Program\ Files/Java/jdk1.8.0_172

You can use this in the terminal there.

Jubin Justifies
  • 397
  • 4
  • 12
Uma
  • 11
  • 1
1

You only need to put the space in between Program and files like:

java.home :- "C:/Program Files/Java/jdk1.8.0_111"

0

In case this question is still open.

Try placing a space between the words, Program and Files, so it reads:

"C:/Program Files/Java/jdk1.8.0_131"

nevyn
  • 33
  • 8