Srijan Gupta
Srijan Gupta

Reputation: 135

JAR does not exist or is not a normal file

While running the wordcount example in Hadoop, I am facing the following error.

saying "JAR does not exist or is not a normal file: 
/usr/local/hadoop/share/hadoop/mapreduce/hadoop-mapreduceexamples-2.2.0.jar"

My input command was :

hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduceexamples-2.2.0.jar  wordcount input output

Upvotes: 7

Views: 19690

Answers (6)

Databank255
Databank255

Reputation: 1

I was doing this for a school project, and they had this at the bottom. A solution to our problem: Run:

export HADOOP_CLASSPATH=${JAVA_HOME}/lib/tools.jar

Compile

hadoop com.sun.tools.javac.Main WordCount.java

Make Jar:

jar cf wc.jar WordCount*.class

Finally, as we were doing...:

hadoop jar wc.jar WordCount /user/your_name/wordcount/input /user/your_name/wordcount/output

Ran it, worked immediately.

Upvotes: 0

dasen
dasen

Reputation: 21

I faced this problem same, beacause I am in /opt/module/hadoop-3.1.3/wcinput directory.

When cd /opt/module/hadoop-3.1.3 , and then try this again :

hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar wordcount wcinput wcoutput.

it worked.

Upvotes: 1

INDRAJITH EKANAYAKE
INDRAJITH EKANAYAKE

Reputation: 4294

Since .jar path can differ from distribution to distribution it's hard to say the exact path and obviously, you can cd into each directory and check, but you ever imagine there is an easy way. Just execute the following command and it will list all the jar files named hadoop-mapreduceexamples-2.2.0.jar with the exact location,

find . -name hadoop-mapreduceexamples-2.2.0.jar

Or if you do not know the name of the .jar file you can try this,

find . -name *.jar

Upvotes: 1

DevLoverUmar
DevLoverUmar

Reputation: 14011

I faced the same problem and problem was with the version number in file. For example, in the installation instructions, the command was:

bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.2.1.jar grep input output 'dfs[a-z.]+'

While the version I'm working with was 3.1.3 so what worked for me was:

bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar grep input output 'dfs[a-z.]+'

Upvotes: 4

Kasun Kariyawasam
Kasun Kariyawasam

Reputation: 2447

Just check whether all the dependencies are included in your jar file. Try something like this.

hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduceexamples-2.2.0-jar-with-dependencies.jar  wordcount input output

Upvotes: 2

aysegulpekel
aysegulpekel

Reputation: 324

Just go to that path and check it out if the name is correct or not, the convention may differ by the distribution.

For example, hadoop 3.1.0 has it in the following path:

$HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.0.jar

Upvotes: 9

Related Questions