English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Java Basic Tutorial

Java Flow Control

Java Array

Java Object-Oriented (I)

Java Object-Oriented (II)

Java Object-Oriented (III)

Java Exception Handling

Java List (List)

Java Queue (Queue)

Java Map Collection

Java Set Collection

Java Input/Output (I/O)

Java Reader/Writer

Java Other Topics

Java Development Environment Installation

Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, and more. Java applications are usually compiled to run on any Java Virtual Machine (JVM).Bytecode, and is unrelated to computer architecture.

The following is the environment setup for Linux and Windows. JVM, JRE, and JDK all depend on the platform because each operating system's configuration is different. However, Java is platform-independent.

Before setting up the environment, let's first understand the respective uses of the following terms:

  1. JDK(Java Development Kit): JDK is used by software developers and includes development tools such as the Java compiler, Javadoc, Jar, and debugger.

  2. JRE(Java Runtime Environment): JRE includes the Java library components needed to run Java programs and is used by end users. JRE can be considered a subset of JDK.

  3. JVM: JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides a runtime environment in which Java bytecode can be executed. JVM can be used on many hardware and software platforms.

Steps to set up the Windows Java environment

  1. Download JDK (this article is about Java8
    Firstly, we need to download the Java Development Kit (JDK), the Aliyun mirror download address is:https://code.aliyun.com/kar/oracle-jdk/raw/3c932f02aa11e79dc39e4a68f5b0483ec1d32abe/jdk-8u251-windows-x64.exe

  2. After downloading, run.exeDownload it, run

    Install JDK, you can customize the installation directory and other information during the installation process, for example, we choose the installation directory to be C:\Program Files\Java\jdk1.8.0_251

  3. Go toSpecify panel->System and Security->System.

  4. Under the 'Advanced System Settings' option, click on the Environment variables, as shown below.

  5. In "System variablesSet in " 3 Item attribute, JAVA_HOME, PATH, CLASSPATH (case insensitive), if it already exists, click 'Edit', if it does not exist, click 'New'.
    The variable setting parameters are as follows:

    Variable name: JAVA_HOME
    Variable value: C:\Program Files\Java\jdk1.8.0_251        // Configure according to your actual path
    Variable name: CLASSPATH
    Variable value: .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;         //Note that there is a '.' at the beginning
    Variable name: Path
    Variable value: %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;
  6. Click OK, save the settings, and you are done! Now, to check if the installation has been completed correctly, open the command prompt and enterjavac -version. You will see the output information before, indicating that the installation has been completed correctly.

  7. C:\Users\Administrator>javac -version
    javac 1.8.0_251
  8. To determine if the compiler is installed, enter the following at the command promptjavac. You will see a list related to javac.

Linux steps

There are several ways to install Java on Linux. However, we will introduce the simplest method to install Java using the terminal. For Linux, we will install OpenJDK. OpenJDK is a free and open-source implementation of the Java programming language.

  1. Go toApplication->Attachment->Terminal.

  2. Enter the following command.

    sudo apt-get install openjdk-8-jdk
  3. For the 'JAVA_HOME' (environment variable), as shown below, enter the installation path in the 'Terminal' using the command... (Note: The default path is as shown, but if you have installed OpenJDK at another location, please set this path.)

    export JAVA_HOME= /usr/lib/jvm/java-8-openjdk
  4. For the 'PATH' (environment variable), enter the command using the installation path in the 'Terminal' as follows... Note: The default path is as shown, but if you have installed OpenJDK in another location, please set this path.)

    export PATH=$PATH:/usr/lib/jvm/java-8-openjdk/bin
  5. You are done! Now to check if the installation is completed correctly,PleaseType in the terminaljava -version. You will see Java running on the computer.

  6. Popular Java Editors/ IDE:

    • Notepad++ / gedit: They are simple text editors used to write Java programs. Notepad++Available on Windows, while gedit is available on Linux.

    • Eclipse IDE: It is the most widely used IDE (Integrated Development Environment) for developing software with Java. You can downloadHereDownload Eclipse .

    • IntelliJ IDEA: is an integrated development environment (IDE) developed for the Java programming language.