Updated on 2023-04-10 GMT+08:00

Compiling and Running an Application

Scenario

After the code development is complete, you can run the application in the Windows development environment.

If the network between the local and the cluster service plane is normal, you can perform the commissioning on the local host.

  • If IBM JDK is used in the Windows development environment, the application cannot be 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 an application.

    Place the configuration file directory and modify the code to match the login user. See Figure 2.

    Figure 2 Directory list of hbase-example to be compiled
    1. Compile an application.
      • 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, double click compile to run the compile command of Maven.

        Figure 3 clean and compile tools of Maven
      • 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 4 Enter mvn clean compile in the IDEA Terminal text box.

        After the compilation is complete, the message "Build Success" is displayed and the target directory is generated.

        Figure 5 Compilation completed
    2. Run the program.

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

      Figure 6 Run the application.