Java Development Environment Configuration
In this chapter, we will introduce how to set up the Java development environment.
- Installing the Development Environment on Windows
- Installing the Development Environment on Linux
- Java IDE Introduction
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:
-
Variable name:JAVA_HOME
-
Variable value:C:\Program Files (x86)\Java\jdk1.8.0_91 // Configure according to your actual path
-
Variable name:CLASSPATH
-
Variable value:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; // Remember there is a "." at the front
-
Variable name:Path
-
Variable value:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;
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:
-
JetBrains IntelliJ IDEA, which many people are now starting to use; it is very powerful. Download address:https://www.jetbrains.com/idea/download/

-
VSCode : VSCode (full name: Visual Studio Code) is a free, cross-platform source code editor developed by Microsoft.
Download address:https://code.visualstudio.com/
Installation tutorial: https://www.runoob.com/w3cnote/vscode-tutorial.html

-
Netbeans:An open-source, free Java IDE. Download address: https://www.netbeans.org/index.html

-
Eclipse:Another free, open-source Java IDE. Download address: https://www.eclipse.org/downloads/packages/
Choice Eclipse IDE for Java Developers:
Creating Your First Java Application with IntelliJ IDEA
- 1. Launch IntelliJ IDEA.
- 2. Click "New Project" on the welcome screen.
- 3. In the "New Project" wizard, select "Java" from the left list.
- 4. Name the project (e.g., HelloWorld) and change the default location as needed.
- 5. In this tutorial, we will not use a version control system, so disable the "Create Git repository" option.
- 6. Make sure IntelliJ is selected in the build system.