I tried Hadoop and did not expect to follow the tutorial. The first example reported an error ...... Error: $ binhadoopjarhadoop-mapred-examples-0.21.0.jargrepinputoutputdfs [a-z.] + Exceptioninthreadmainjava. io. IOException: erropeningjobjar: hadoop-mapred-ex
I tried Hadoop and did not expect to follow the tutorial. The first example reported an error ......
The error is as follows:
$ Bin/hadoop jar hadoop-maprEd-ExAmples-0.21.0.jarGrepInput output'DfS [a-z.] +'
Exception in thread "main" java. io. IOException: Error opening job jar: hadoop-mapred-examples-0.21.0.jar
At org. apache. hadoop. util. RunJar. main (RunJar. java: 90)
CauSedBy: java. util.Zip. ZipException: error in opening zipFile
At java.util.zip. ZipFile. open (Native Method)
At java.util.zip. ZipFile. (ZipFile. java: 127)
At java. util. jar. JarFile. (JarFile. java: 135)
At java. util. jar. JarFile. (JarFile. java: 72)
At org. apache. hadoop. util. RunJar. main (RunJar. java: 88)
A closer look, java.util.zip. ZipException is an exception that cannot be found in the file. The main reason is that the hadoop-mapred-examples-0.21.0.jar cannot be located. The solution is very simple.
1) configure the environment variables first (if you are operating in the hadoop home directory, you can try it)
$ Vim/etc/profile
Add these two rows
ExportHADOOP_HOME =/home/linrui/programfiles/dev/hadoop-0.20.203.0
Export HADOOP_CONF_DIR = $ HADOOP_HOME/conf
2) Go To The hadoop_home directory and check the jar package (this package exists, but the name may not be the same). Then write the name accurately.
Then run ~ Everything is OK!