Updated on 2024-08-10 GMT+08:00

Compiling and Running Applications

Scenario

Run applications in a Windows development environment after application code is developed. If the local and cluster service planes can communicate with each other, you can perform the commissioning on the local host.

  • If the IBM JDK is used in the Windows environment, applications cannot be directly run in the Windows environment.
  • You need to set the mapping between the host names and IP addresses of the access nodes in the hosts file on the local host where the sample code is run. The host names and IP addresses must be mapped one by one.

Procedure

  1. Click Reimport All Maven Projects in the Maven window on the right of the IDEA to import the Maven project dependency.

    Figure 1 reimport projects

  2. Compile and run the application.

    Modify the IP address, port number, login username, and password of the IoTDBServer node that matches the code.

    1. Use either of the following two methods:
      • Method 1

        Choose Maven > Sample project name > Lifecycle > clean and double-click clean to run the clean command of Maven.

        Choose Maven > Sample project name > Lifecycle > compile and double-click compile to run the compile command of Maven.

        Figure 2 Maven tools clean and compile
      • Method 2

        Go to the directory where the pom.xml file is located in the Terminal window in the lower part of the IDEA, and run the mvn clean compile command to compile the pom.xml file.

        Figure 3 Enter mvn clean compile in the IDEA Terminal text box.

        After the compilation is complete, the message "BUILD SUCCESS" is displayed.

        Figure 4 Compilation completed
    2. Run the application. A JDBC application is used as an example. The operations for running other applications are the same.

      Right-click the JDBCExample.java file and choose Run 'JDBCExample.main() from the shortcut menu.

      Figure 5 Running the application