VsCode configures the JAVA compilation environment


Probably just a few steps, download jdk-add jdk to environment variables-vscode install related plug-ins

jdk download

insert image description here
Download this file
Link: https://pan.baidu.com/s/1asQ9Owtf1fDKvZYGg2CXZg
Extraction code:
After c1fv is downloaded, click on this .exe file, and the following page will pop up:
Please add a picture description
Keep clicking Next, when selecting the jdk download path, It is recommended not to change it, so that the system will default to C:\Program Filesthis location on the C drive, and it will be easy to find in the future.

Add java to environment variables

Go to the folder where you downloaded jdk just now. If the path has not been modified, it will be in C:\Program Filesthis folder by default.
Please add a picture description
Click to enter, there will be a Javafolder called , click to open, Please add a picture description
Please add a picture description
and then fill in the address of the bin folder into the environment variable.
The default address is: as C:\Program Files\Java\jdk1.8.0_74\bin
shown in the picture:
Please add a picture description
Please add a picture description
Please add a picture description
like this, it will be fine.

vscode plugin download

There are quite a few plug-ins to download. The easiest way is to add a .javafile, and the program will pop up a prompt to install the Java Extension Pack. Just click on it. Please add a picture description
After all the downloads are complete, restart vscode and write this code in the file
you just created .java:

public class Hello {
    
    
    public static void main(String[] args) {
    
    
        System.out.println("Hello world");
    }
}

Just run it successfully
insert image description here

Guess you like

Origin blog.csdn.net/qq_52109814/article/details/122399293