【vscode】vscode配置Java

【vscode】vscode配置Java

前言

配环境,需要记录,避免反复踩坑。

步骤

step1:官网走

配环境为什么不直接上官网教程,Visual Studio Code - Code Editing. Redefined

image

点击Java

image

step2:配置必需的环境

Coding Pack for Java

To help you set up quickly, you can install the Coding Pack for Java, which includes VS Code, the Java Development Kit (JDK), and essential Java extensions. The Coding Pack can be used as a clean installation, or to update or repair an existing development environment.

Install the Coding Pack for Java - Windows

Install the Coding Pack for Java - macOS

Note: The Coding Pack for Java is only available for Windows and macOS. For other operating systems, you will need to manually install a JDK, VS Code, and Java extensions.

这里,我们需要适用于Java的编码包,如果还没有下载vscode的话,且操作系统正好是Windows或者macOS,大可下载这个一步到位。

不过,我们已经有了vscode,我们就要采取另一种策略了,即安装扩展和环境

Installing extensions

If you are an existing VS Code user, you can also add Java support by installing the Extension Pack for Java, which includes these extensions:

Install the Extension Pack for Java

image

安装完扩展之后,我们需要安装JDK​,从而让我们能在vscode里面使用Java

Installing and setting up a Java Development Kit (JDK)

To use Java within Visual Studio Code, you need to install a Java Development Kit (JDK) on your local environment. JDK is a software development environment used for developing Java applications.

Supported Java versions

The Extension Pack for Java supports Java version 1.5 or above.

Note: To configure JDKs for your projects, see Configure Runtime for Projects. To enable Java preview features, see How can I use VS Code with new Java versions.

Installing a Java Development Kit (JDK)

If you have never installed a JDK before and need to install one, we recommend you to choose from one of these sources:

假如我们的电脑上没有安装过JDK​,且需要安装一个的话,那么我们就可以从上述给出的来源之一下载,这里,我们选择Oracle Java SE​,版本,个人选择的是JDK​。

image

这里,我们希望用自带的安装程序一步到位(不太想自己调整什么环境变量之类的,可以,但是暂时没必要),两个Installer似乎没有太大区别

image

然后就是安装过程,点点点。

image

这里,我们可以换个路径安装。

image

step3:运行一下Java看看?

image

很好,一下子就报错,没关系,我们只需要稍作调整。

首先,让我们根据报错看看怎么个事儿吧。

image

大意就是我下的JDK​找不到(因为我改了下载的路径),怎么办呢?去设置瞧瞧看

image

然后设置一下

image

image

嗯,很神奇,我并不需要配置环境变量。

参考资料

​​

  • 25
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值