Java development environment configuration and Vscode construction process


Java development environment configuration

Before configuring the environment, first use the cmd command to check whether the machine has been configured with a Java environment. The test command is (java or javac or java -version [there is a space between java and -])


If the above information appears, it means that the configuration has been completed, and there is no need to repeat the operation! ! ! Otherwise, perform the following operations.

Install JDK in your computer,download link, enter and slide down to display the interface


Select the version suitable for you to download, here is the Windows X64 Installer download. Downloading from Oracle's official website involves account registration, you can also visit thislink to download, extraction code: wien

After downloading, click the program to run


All operations do not need to be changed, just continue to the next step


Copy the path of the JDK installation. Continue to configure system environment variables.

Right-click this computer -> Properties -> Advanced System Settings -> Environment Variables, enter the following interface


Paste the path where the JDK is installed on the computer above (the path can be changed, and the follow-up operations are completed according to the original path here):
Click "New", enter the following as shown (the second line enters the installation path of your computer's JDK)
C:\Program Files\Java\jdk-16.0.1


2. The operation is the same as above, and continue to add the following information:


Add the directive in the Path variable


Click "New" on the right to add these two instructions

All the way to be determined, and finally enter the cmd window as well, enter the java -version, java, javac commands respectively, the following information is displayed, indicating that the configuration is successful.


At this point, the Java environment configuration is over.

Configure the Java development environment in Vscode

Vscode is a lightweight source code editor that is well-received for its numerous plugin support. Next, we configure the Java development environment in Vscode.
First find this plugin in the Vscode extension to install


Java Extension Pack is an extension package that contains some necessary plug-ins for Java development. Generally, basic installation is enough.


Use the keyboard shortcut Ctrl+Shift+P to open the command panel, enter Configure Java Runtime, and you can see the version of your JDk installed at ②. If you installed Vscode first, you can also click ③ to download the JDK on the pop-up website, and follow the instructions above. text configuration.


Shortcut Ctrl+, enter settings and click Edit in settings.json
Paste the JDK installation path in javahome (note: when it comes to escape characters, change \ to \ or / )
Tips: The mouse selects a \ shortcut key Ctrl+D, continuous tapping can quickly select all \ , you can change it directly on the keyboard


After the configuration is complete, write a Java version of HelloWorld for testing.

public class HelloWorld {
	public static void main(String[] args) {
		System.out.println("Hello World!");

Click the debug icon on the left to generate the launch.json file


Because the plug-in developed by Java has been installed, click Run directly to see the output in the console


All configurations have been completed, I hope to help everyone!

So far, this article about the configuration of the Java development environment and the Vscode construction process is introduced here. For more information about the configuration of the Java development environment in Vscode, please search for the previous articles of developpaer or continue to browse the related articles below. I hope you will support developpaer more in the future!