Updated on 2023-07-19 GMT+08:00

Configuring the Java Environment

Scenario

Table 1 describes the environment required for secondary development.

Table 1 Development environment

Item

Description

Installing the Operating System (OS)

Windows OS. Windows 7 or later is recommended.

Installing the JDK

Basic configurations of the development environment. JDK 1.7 or 1.8 is required. You are advised to use JDK 1.8 for better compatibility of later versions.

Eclipse installation and configuration

It is a tool used to develop DLI applications.

Procedure

  1. Download JDK of 1.8 or a later version from the Oracle's official website, install the JDK, and configure Java environment variables.

    1. Install the JDK.
    2. Set environment variables. Specifically, choose Start > Control Panel. Click System > Advanced system settings. In the displayed System Properties dialog box, click Advanced and then click Environment Variables to switch to the Environment Variables dialog box.
    3. Create the system variable JAVA_HOME with Value set to the JDK installation path, for example, D:\Java\jdk1.8.0_45.
    4. Edit the Path variable and add %JAVA_HOME%\bin to Variable value.
    5. Create the CLASSPATH variable with Variable value set to .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar.
    6. Check whether the configurations succeed. Specifically, at the Start menu, enter cmd and press Enter to bring up the command prompt window. Enter java -version and press Enter. If the version information is displayed, as shown in Figure 1, the JDK is successfully installed and environment variables are successfully configured.
      Figure 1 Checking the configuration

  2. Download Eclipse IDE for Java Developers of the latest version from the Eclipse's official website and install it. Configure the JDK in Eclipse.

    1. Create a project and select the correct JRE version. For details, see Figure 2.
      Figure 2 Creating a project

  3. Configure and import the SDK JAR package.

    1. Right-click JRE System Library and choose Build Path > Configure Build Path from the shortcut menu. For details, see Figure 3.
      Figure 3 Configuring the project path
    2. Click Add External JARs, select the downloaded JAR package obtained in Downloading SDK, and click OK.
      Figure 4 Selecting the SDK JAR package