Compiling and Running Java OJAI Applications
For applications that use the Java OJAI API, use Maven to compile and determine the application's dependencies. Then, when you run the application, specify those dependencies in the application's classpath.
Compile and Determine Dependencies
Use Maven to compile and determine the application dependencies.
    - Add MapR's Maven repository to your 
pom.xmlfile, if it is not already added:<repositories> <repository> <id>mapr-releases</id> <url>https://repository.mapr.com/nexus/content/repositories/releases</url> <snapshots><enabled>true</enabled></snapshots> <releases><enabled>true</enabled></releases> </repository> </repositories> - Add a dependency to the MapR OJAI driver
              project:
<dependencies> <dependency> <groupId>com.mapr.ojai</groupId> <artifactId>mapr-ojai-driver</artifactId> <version>6.0.0-mapr</version> </dependency> </dependencies>NOTEReplace the<version>property with the HPE Data Fabric Database version that you are using. - Use Maven to compile the application and resolve dependencies.
 
Run the Application
When you develop a Java application, you can use a dependency management
      tool such as Maven to compile your application. However, it is recommended that you do the
      following instead: 
      - Compile the Java application without including dependencies
 - Specify the required classpath when you submit the application to the cluster
 
When the cluster is secure, the node must also have a MapR ticket configured for the user that runs the application.
You can use the following command to launch HPE Data Fabric Database JSON
        applications:
    java -cp <classpath>:. -Djava.library.path=/opt/mapr/lib <main class JAR> <command line arguments>Enable OJAI Tracing
To help debug your Java OJAI application, you can enable OJAI tracing.  MapR uses the
          log4j API to log tracing messages.  To enable writing these messages to
        standard output, follow these steps:
- Set the following property in your 
/opt/mapr/conf/log4j.propertiesfile:log4j.logger.com.mapr.ojai.store.impl=TRACE, stdout - Add the following to your 
javalaunch command:- In your java classpath, add the library that includes custom MapR
                
log4jclasses:-cp /opt/mapr/lib/central-logging-8.0.0-mapr.jar:<other classpaths>:. - Define the location of the 
log4j.propertiesfile:-Dlog4j.configuration=file:/opt/mapr/conf/log4j.properties 
 - In your java classpath, add the library that includes custom MapR