Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Java Development Environment Configuration

Java Development Environment Configuration

In this chapter, we will introduce how to set up the Java development environment.


Installing Java on Windows

Download the JDK

First we need to download the Java Development Kit (JDK). Download address:https://www.oracle.com/java/technologies/downloads/, choose the corresponding version based on your system on the download page. This article uses the Windows 64-bit system as an example:

After downloading, install the JDK by following the prompts. The JRE will also be installed when you install the JDK; just install them together.

When installing the JDK, you can customize the installation directory and other information during the installation. For example, we choose the installation directory as C:\Program Files (x86)\Java\jdk1.8.0_91.

Configure Environment Variables

1. After installation, right-click "My Computer", click "Properties", and select "Advanced system settings";

2. Select the "Advanced" tab and click "Environment Variables";

Then a screen like the one shown below will appear:

Set 3 properties in "System variables": JAVA_HOME, PATH, and CLASSPATH (case-insensitive). If they already exist, click "Edit"; if not, click "New".

Note:If you use a JDK version 1.5 or above, you do not need to set the CLASSPATH environment variable; Java programs can still compile and run normally.

The variable settings parameters are as follows:

JAVA_HOME setting

PATH setting

Note:In Windows 10, the Path variable is displayed item by item, so we need to add %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; separately; otherwise it will not be recognized:


%JAVA_HOME%\bin; %JAVA_HOME%\jre\bin;

For more information, refer to:Configuring Java Environment Variables on Windows 10

CLASSPATH setting

This is the Java environment configuration. After configuration, you can start Eclipse to write code, and it will automatically complete the Java environment configuration.

Test Whether the JDK Is Installed Successfully

1. "Start" -> "Run", type "cmd";

2. Type the command: java -version, java, javac Several commands. If the following information appears, the environment variables are configured successfully;


Linux, UNIX, Solaris, FreeBSD Environment Variable Settings

The PATH environment variable should be set to point to the location where the Java binary files are installed. If you have difficulty with the settings, refer to the shell documentation.

For example, assuming you use bash as your shell, you can add the following to the end of your .bashrc file: export PATH=/path/to/java:$PATH


Popular Java Development Tools

As the saying goes, "A workman must first sharpen his tools if he is to do his work well." We also need a good development tool when developing in Java. There are many IDEs on the market today; this article recommends the following Java development tools:


Creating Your First Java Application with IntelliJ IDEA