【vscode】vscode配置Java
前言
配环境,需要记录,避免反复踩坑。
步骤
step1:官网走
配环境为什么不直接上官网教程,Visual Studio Code - Code Editing. Redefined
点击Java
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:
安装完扩展之后,我们需要安装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
。
这里,我们希望用自带的安装程序一步到位(不太想自己调整什么环境变量之类的,可以,但是暂时没必要),两个Installer似乎没有太大区别
然后就是安装过程,点点点。
这里,我们可以换个路径安装。
step3:运行一下Java看看?
很好,一下子就报错,没关系,我们只需要稍作调整。
首先,让我们根据报错看看怎么个事儿吧。
大意就是我下的JDK
找不到(因为我改了下载的路径),怎么办呢?去设置瞧瞧看
然后设置一下
嗯,很神奇,我并不需要配置环境变量。
参考资料
标签:Code,Java,JDK,vscode,配置,Coding,Pack From: https://www.cnblogs.com/riskmoumou/p/18069337/vscode-vscode-configuration-java-7wwb8