使用 Microsoft Visual Studio Code 进行 Java 编程 [英] Java Programming with Microsoft Visual Studio Code

查看:27
本文介绍了使用 Microsoft Visual Studio Code 进行 Java 编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Microsoft Visual Studio Code 中下载了 Red Hat 对 Java 的语言支持,

I downloaded language support for Java by Red Hat in Microsoft Visual Studio Code,

但我遇到了如上图所示的问题.

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

所以我尝试在 VSCode 的 settings.json 文件中设置我的 JDK 路径:

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?

推荐答案

在设置文件中输入java.home变量后必须重启VS Code.

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

或者,甚至不需要设置该变量.你可以从你的设置中删除它,VS Code 会自动检查你的 JDK_HOME 和 JAVA_HOME 的用户/系统环境变量.

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.

请参阅 https://marketplace.visualstudio.com/items 上的设置 JDK"?itemName=redhat.java

有关如何设置环境变量的信息,请参阅Java 安装的环境变量

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

这篇关于使用 Microsoft Visual Studio Code 进行 Java 编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆