testtraveler

博客园 首页 新随笔 联系 订阅 管理
  19 随笔 :: 0 文章 :: 2 评论 :: 4076 阅读

【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

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

参考资料

​​

posted on   testtraveler  阅读(153)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示