Java programming using Microsoft Visual Studio Code

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

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

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

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

But the problem has not yet been resolved.

Do you know how to solve this problem?

+13
source share
7 answers

You need to restart the VS code after entering the java.home variable in the settings file.

Alternatively, setting this variable is not 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 "Configuring JDK" at https://marketplace.visualstudio.com/items?itemName=redhat.java

For information on how to set environment variables, see Environment Variables for Installing java

+8
source

you should change the path like this:

 "java_home":"C:\\ProgramFiles\\Java\\jdk1.8.0_111" 
+3
source

My Visual Studio code is configured to use the 32-bit version of the JDK

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

Check java version from command line:

java -version

You may need to add your version in PATH :

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

And install your JAVA_HOME system:

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 the local user.

+2
source

try changing the path as follows:

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

Pay attention to the space in the "Program Files" on the way .

+2
source

If you are using bash from VSCode, you should use:

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

You can use it in the terminal there.

+1
source

In case this question is still open.

Try putting a space between words, a program, and files so that it reads:

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

0
source

You only need to put the space between the program and the files, for example:

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

0
source

Source: https://habr.com/ru/post/1264440/


All Articles