search
HomeCommon ProblemHow to configure environment variables after installing jdk

Steps to configure environment variables after installing jdk: 1. Configure Path variables; 2. Configure CLASSPATH variables; 3. Test environment variable configuration.

How to configure environment variables after installing jdk

Install JDK (Java Development Kit) It is one of the basic steps in developing Java programs. After installing the JDK, we need to configure the environment variables so that the java and javac commands can be used in the command line window. This article will introduce how to configure JDK environment variables in Windows systems.

Before configuring the JDK environment variables, please ensure that the JDK has been successfully installed. You can download and install the latest JDK version from the Oracle official website. After the download is complete, install it through the installation wizard. After the installation is complete, you can find the JDK installation directory.

Preparation work:

Before configuring environment variables, you need to do some preparation work. First, open the "Start" menu, click "Computer", and then click "Properties". In the window that opens, click "Advanced system settings."

Next, in the pop-up "System Properties" window, click the "Environment Variables" button. In the "Environment Variables" window, we will configure the environment variables required by the JDK.

Configure JAVA_HOME variable:

In the user variable area, click the "New" button to create a new system variable. In the variable name input box, enter "JAVA_HOME". In the variable value input box, enter the installation path of the JDK.

For example, if the JDK installation directory is "C:\Program Files\Java\jdk1.8.0_271", enter the directory in the variable value input box. Then click the "OK" button to save the variable.

Configure the Path variable:

In the "Environment Variables" window, in the user variable area, find the system variable named "Path". Select this variable and click the "Edit" button.

In "Edit Variable Value" In the window, the cursor is located at the end of the input box. Enter an additional semicolon at the end of the input box, and then enter "%JAVA_HOME%\bin". Click the "OK" button to save the variable.

Configure the CLASSPATH variable:

In the "Environment Variables" window, in the user variable area, click the "New" button to create a new system variable. In the variable name input box, enter "CLASSPATH". In the variable value input box, enter ".;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar".

Click the "OK" button to save the variable.

At this point, we have configured the JDK environment variables. Next, we need to test whether the configuration is successful.

Test the environment variable configuration:

Open the command line window, enter the "java -version" command. If the environment variable is configured correctly, the JDK version information will be displayed.

Similarly, enter the "javac" command in the command line window. If the configuration is correct, the JDK version information will be displayed. Display the javac usage help information.

If you can see the JDK version information and javac usage help information, then congratulations, you have successfully configured the JDK environment variables.

Summary:

After installing the JDK, configuring environment variables is a very important step. Only when the environment variables are correctly configured can we use the java and javac commands in the command line window for development. Hope This article can help you successfully configure the JDK environment variables and start writing Java programs .

The above is the detailed content of How to configure environment variables after installing jdk. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version