Compiling and Running a Java Application
You can compile and run the java application using JAR files from the MapR Maven repository or from the MapR installation.
Using JARs from the MapR Maven Repository
MapR publishes Maven artifacts from version 2.1.2 onward at http://repository.mapr.com/maven/. When compiling for MapR version 4.0.1, add the following dependency to the project's pom.xml file:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>2.4.1-mapr-1408</version>
</dependency>
This dependency will pull the rest of the dependencies from MapR's Maven repository the next
time you do a mvn clean install
.The JAR that includes the maprfs library is a
dependency for the hadoop-core artifact.
For a complete list of MapR-provided artifacts and further details, see Maven Repository and Artifacts for MapR.
Using JARs from the MapR Installation
The maprfs library is included in the hadoop classpath. Add the hadoop classpath to the JAVA classpath when you compile and run the java application.
- Use the following command to compile the sample
code:
javac -cp $(hadoop classpath) MapRTest.java
- Use the following command to run the sample
code:
java -cp .:$(hadoop classpath) MapRTest /test