Java Programming with Microsoft Visual Studio Code

2020-06-01 03:49发布

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?

7条回答
手持菜刀,她持情操
2楼-- · 2020-06-01 03:56

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"

查看更多
劳资没心,怎么记你
3楼-- · 2020-06-01 03:59

you should change the path to be like this:

"java.home":"C:\\Program Files\\Java\\jdk1.8.0_111"
查看更多
SAY GOODBYE
4楼-- · 2020-06-01 04:06

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.

查看更多
欢心
5楼-- · 2020-06-01 04:08

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.

查看更多
Rolldiameter
6楼-- · 2020-06-01 04:12

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

查看更多
Fickle 薄情
7楼-- · 2020-06-01 04:12

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

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

查看更多
登录 后发表回答