2
votes

I have problem setting up JAVA_HOME correctly for Hadoop on OS X 10.7 Here is what I have done: went to /usr/local/Cellar/hadoop/1.0.3/libexec/conf/hadoop-env.sh and changed JAVA_HOME form whatever it was there for default to export JAVA_HOME=/Library/Java/Home/ I am also pretty new to Java too, so even JAVA_HOME might be wrong too . So by going to bin folder of hadoop and running this command: hadoop jar hadoop-*-examples.jar This is the nasty error I get:

Exception in thread "main" java.io.IOException: Error opening job jar: hadoop-*-examples.jar
    at org.apache.hadoop.util.RunJar.main(RunJar.java:90)
Caused by: java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:135)
    at java.util.jar.JarFile.<init>(JarFile.java:72)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:88)

Do you have any idea how can I fix this or what is the problem? this is also the output of "which javac" commnad in case you need it: /usr/bin/javac

Thanks

3

3 Answers

3
votes

Hadoop example jar file is hadoop-1.0.3-examples.jar` for the version of Hadoop which you are using. Use the proper jar file name in the command and it should work.

Coming to the JAVA_HOME, it's set proper since you are getting a Java exception, otherwise it would have been a different error.

Hope it helps. For those who are getting started with Hadoop, here is a consolidated list of useful resources.

1
votes

I must have gone to the "libexec" folder and then ran that command.

1
votes

Me also face the same issue, please check your jar file and class name, Java is case sensitive. also check with your command which should have a proper space in between each word

now i resolve the issue.. all the best