Building and Launching Applications
Prerequisites
- Verify that the
mapr-client
package is installed on the node. Themapr-client
package must be installed on each node that builds an application. Thelibhbase
header files are in this directory:/opt/mapr/include/hbase
- Verify that both the
libMapRClient
library andlibjvm
shared libraries are in the application’s library search path. ThelibMapRClient
library is located in this directory:/opt/mapr/lib
Building Applications
When building applications that use the MapR version of libhbase
, run
this command:
gcc -o <application_name> <source_file> -I/opt/mapr/include/hbase -L/opt/mapr/lib/ -lMapRClient -L/usr/lib/jvm/java-7-sun/jre/lib/amd64/server -ljvm
For example, the following command builds the hello_hbase
application
with the hello_hbase.c
source code:
gcc -o hello_hbase hello_hbase.c -I/opt/mapr/include/hbase -L/opt/mapr/lib/ -lMapRClient -L/usr/lib/jvm/java-7-sun/jre/lib/amd64/server -ljvm
- The compiled
libMapRClient
is statically linked to the following third-party libraries:- Crypto++:
libcryptoapp.a
(v5.6.2) - Protobuf:
libprotobuf-lite.a
(v2.5.0)
- Crypto++:
- The
libMapRClient
library has dependencies onlibjvm
, though a JVM is not instantiated. In general, thelibjvm
library is located within the JDK/JRE installation directory.
Launching Applications
Before launching an application, set this value for the environment variable
LD_LIBRARY_PATH
:
/opt/mapr/lib:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server
If the client is on Windows, append the following directories to the
PATH
environment variable:
-
$MAPR_HOME/lib
-
$JAVA_HOME/bin/server
If the application uses the hb_connection_create_as_user
API for
impersonation, set the MAPR_IMPERSONATION_ENABLED
environment variable
to true
.
You can now launch the application.