简体   繁体   中英

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.

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.

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 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM