Farrukh
Farrukh

Reputation: 91

Hadoop YARN simple yarn application

I am trying to run the simple yarn application listed here: https://github.com/hortonworks/simple-yarn-app

I am a beginner with both Java and Hadoop, and when I try to compile the simple yarn Client file using 'javac', I get the following error:

Client.java:9: error: package org.apache.hadoop.conf does not exist

import org.apache.hadoop.conf.Configuration;

The command I am using to compile the file is:

javac Client.java

I have Googled this error to see if I could find which JAR file is missing from my classpath, but I couldn't find anything helpful with respect to YARN. Most of the results were related to HBASE, PIG or HIVE.

Can someone please point me towards the relevant JAR file I am missing here? Thanks.

Upvotes: 4

Views: 1537

Answers (2)

Farrukh
Farrukh

Reputation: 91

The issue has been resolved. I didn't need to manually add JAR files to the classpath. I simply used the command 'bin/hadoop classpath'. It automatically adds the required JAR files.

The command used to compile the file:

# javac -cp `$HADOOP_HOME\bin\hadoop classpath` Client.java 

Upvotes: 3

Ramanan
Ramanan

Reputation: 1000

Add hadoop jars in your classpath:

HADOOP_CLIENT=/usr/lib/hadoop/client-0.20
HADOOP_LIB=/usr/lib/hadoop/lib

for i in ${HADOOP_CLIENT}/*.jar ; do
    CLASSPATH=$CLASSPATH:$i
done

for i in ${HADOOP_LIB}/*.jar ; do
    CLASSPATH=$CLASSPATH:$i
done

javac -cp $CLASSPATH yourclass.java

Save it as runScript.sh and run it.

Upvotes: 2

Related Questions