Updated on 2024-04-29 GMT+08:00

Compiling and Running an Application When a Client Is Installed

Scenario

HBase applications can run in a Linux environment where an HBase client is installed. After application code development is complete, you can upload a JAR file to the Linux environment to run applications.

Prerequisites

  • You have installed an HBase client.
  • You have installed a JDK in the Linux environment. The version of the JDK must be consistent with that of the JDK used by Eclipse to export the JAR file.

Procedure

  1. Export a JAR file.

    1. Right-click the sample project and choose Export from the shortcut menu.
      Figure 1 Exporting a JAR file
    2. Select JAR file and click Next.
      Figure 2 Selecting JAR file
    3. Select the src and conf directories, and export the JAR file to the specified location. Click Next twice.
      Figure 3 Selecting a path for exporting the JAR file
    4. Click Finish. Exporting the JAR file is complete.

  2. Run the JAR file.

    1. Before running the JAR file on the Linux client, copy the JAR file generated in the application development environment to the lib directory in the client installation directory, and ensure that the permission of the JAR file is the same as that of other files.
    2. Switch to the bin directory in the client directory as the installation user, and then run the following command to Run the JAR file:
      [Ruby@cloudtable-08261700-hmaster-1-1 bin]# ./hbase com.huawei.cloudtable.hbase.examples.TestMain

      com.huawei.cloudtable.hbase.examples.TestMain is used as an example. Use the actual code instead.