Updated on 2026-06-29 GMT+08:00

Compiling and Running an Application When No Client Is Installed

Scenario

In a Linux environment where no HBase client is installed, you can upload the JAR package to the Linux and then run an application after the code development is complete.

Prerequisites

  • A JDK has been installed in the Linux environment. The version of the JDK must be consistent with that of the JDK used by the JAR package exported by IntelliJ IDEA.
  • If the Linux host is not a node in the cluster, set the mapping between the host name and the IP address in the hosts file on the node. The host name and IP address must be in one-to-one mapping.

Procedure

  1. Export a JAR package. For details, see 1 in section Compiling and Running an Application When a Client Is Installed.
  1. Example of whether to run HBase/Phoenix to interconnect with SpringBoot:

    • If yes, perform the following steps to run the sample:
      1. Create a running directory in the Linux environment and place hbase-springboot-*.jar in the target directory to the directory. Upload the configuration file to the corresponding path specified in 1.
      2. Switch to the running directory and run the following command to run the JAR package:

        java -jar hbase-springboot-*.jar

    • If no, go to 3.

  2. Prepare for the required JAR packages and configuration files.

    1. In the Linux environment, create a directory, for example, /opt/test, and create subdirectories lib and conf. Export the JAR package that the sample project depends on. For details about how to export the JAR package, see 3 in 1.4.2.1 Compiling and Running an Application When a Client Is Installed. Upload this JAR file and that exported in 1 to the lib directory on the Linux server. Upload the conf configuration file and authentication file in the sample project to the conf directory on Linux.
    2. In /opt/test, create the run.sh script, modify the following content, and save the file:
      #!/bin/sh
      BASEDIR=`cd $(dirname $0);pwd`
      cd ${BASEDIR}
      for file in ${BASEDIR}/lib/*.jar
      do
      i_cp=$i_cp:$file
      echo "$file"
      done
      for file in ${BASEDIR}/conf/*
      do
      i_cp=$i_cp:$file
      done
      
      java -cp .${i_cp} com.huawei.bigdata.hbase.examples.TestMain

  3. Go to /opt/test and run the following commands to run the JAR packages:

    sh run.sh