Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Java development environment configuration


May 10, 2021 Java


Table of contents


Java development environment configuration

Java development environment configuration

In this section, we'll show you how to build a Java development environment.


The window system installs java

Download JDK


First we need to download the java development kit JDK, download address: http://www.oracle.com/technetwork/java/javase/downloads/index.html


Click on the download button below:

Java development environment configuration


On the download page you need to choose to accept the license and select the appropriate version based on your own system, using the Window 64-bit system as an example:
Java development environment configuration


After downloading, the installation of JDK according to the prompts, as well as the installation of JDK will also install JRE, installation on it.

By installing the JDK, we can customize the installation directory and other information during the installation process, for example, we chose to install the directory as C:\Program Files (x86)\Java\jdk11.0.1.

Configure environment variables

1. Right-click "My →" → "Advanced System Settings→ "Advanced" → "Environment Variables";

Java development environment configuration


2. Select the "Advanced" tab and click on "Environment Variables";
Java development environment configuration

3. Create a new JAVA_HOME "New" system variable (click the "New" button under "System Variable", fill in the variable name and variable value, click OK)

Java development environment configuration



Java development environment configuration


4. Io, the new "CLASSPATH" system variable, the variable value “.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;” (All the contents of the quotation marks, note that the front is the point is not a comma)

Java development environment configuration


5. Double-click the Path variable under System Variable to edit. (You can see JAVA_HOME already exists in the system variables), (some computers "Path" also write "PATH")

Java development environment configuration


This is the java environment configuration, after the configuration is complete, you can start Eclipse to write code, it will automatically complete the java environment configuration.


Set 3 properties in System Variables, JAVA_HOME, PATH, CLASSPATH (case does not matter), click Edit if it already exists, click New if it does not exist.

The variable setting parameters are as follows:

  • Variable name: JAVA_HOME
  • Variable values: C: \Program Files (x86) / Java jdk1.8.0_91 // to be configured according to their actual path
  • Variable name: CLASSPATH
  • Variable values: .; % JAVA_HOME%\lib\dt.jar; % JAVA_HOME%\lib\tools.jar; Remember there's a "." in front of you.
  • Variable name: Path
  • Variable value: %JAVA_HOME%;bin; %JAVA_HOME%\jre\bin;

Note: If you use a version of JDK with more than 1.5, you can compile and run the Java program normally without setting the CLASSPATH environment variable.

Test the JDK through the console if it was installed successfully

1, at the same time press the keyboard "win", "R" two keys to open the run, enter "cmd" to determine the opening of the console.

Java development environment configuration

2, type commands: java -version, java, javac several commands, the following information appears, indicating that the environment variable configuration is successful;


Java development environment configuration

Linux, UNIX, Solaris, FreeBSD environment variable settings

The environment variable PATH should be set to point to the location where the Java binary is installed. If you're having trouble setting up, refer to the shell documentation.

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


Popular JAVA development tool

Is the so-called work to do good things must be first al-Algeoli, we also need a good development tool in the process of developing java language, the current market IDE a lot, this article recommends the following java development tools:

Java development environment configuration

Notepad is a free code editor under Microsoft Windows environment, download address: http://notepad-plus-plus.org/

Run the first Java program with Eclipse

HelloWorld .java file code:

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