stochasticcrap
stochasticcrap

Reputation: 358

Running a Hadoop Map-Reduce Job

I am new with Hadoop and I am trying to run a word count job on a single node cluster that I recently installed on my desktop. I am following the tutorial below:

http://javabeginnerstutorial.com/hadoop/your-first-hadoop-map-reduce-job/

Currently I am stuck on step 3, and receive an error when I attempt to run:

~/development/Hadoop_projects/word_count$ mvn clean install

The error I get is:

Error: JAVA_HOME is not defined correctly. We cannot execute usr/lib/jvm/java-7-openjdk-amd64/bin/java

I think i installed maven correctly, but have no idea. I am running this on ubuntu 14.04, any ideas on what to do about the java home path, or is there another issue going on here?

#

The above error was fixed by fixing the JAVA_HOME path, but now I get the following error once I run mvn clean install:

hduser@venus:~/development/Hadoop_projects/word_count$ mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.088s
[INFO] Finished at: Tue Jul 14 23:07:21 PDT 2015
[INFO] Final Memory: 5M/240M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/hduser/development/Hadoop_projects/word_count). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException

I created the pom.xml file in my word_count folder, but for some reason it is not being recognized when I run mvn. when I ls word_count there is no pom.xml in the directory, but I can see it in the Files gui window.

Upvotes: 0

Views: 166

Answers (2)

Abderrahmen
Abderrahmen

Reputation: 496

I think that the variable JAVA_HOME is not set correctly for you. You should check the value of this system variable. The first course of this tutorial: http://how-to-program-in-java.com/core-java-tutorial/ explains how to set the java environment including the JAVA_HOME variable. The java home is set in the same way for both java and Hadoop.

Upvotes: 0

Tim Biegeleisen
Tim Biegeleisen

Reputation: 520878

There is a terrific Ask Ubuntu article which explains in detail how you can set your JAVA_HOME environment variable. I am applying here the solution I found there, adapted for your particular setup.

Open /etc/environment in any editor and add the following line to the file:

JAVA_HOME="usr/lib/jvm/java-7-openjdk-amd64/"

Note carefully that I did not append bin/java to the path, which would be wrong. From a command prompt type the following to load the new environment variable:

source /etc/environment

Finally, verify that JAVA_HOME be set correctly by typing this in a command prompt:

echo $JAVA_HOME

Upvotes: 1

Related Questions