Monday, February 1, 2016

Set, Verify Or Update Java Version Used With Hadoop

I'm using the following tools for this example:

Linux Mint 17.3
Hadoop 2.5.2 Single Node Setup
JDK 1.6u45

As you all know Hadoop uses Java to run. There may be multiple JDKs on amachine used my many applications. To assign a separate JDK explicitly to your Hadoop instance, do the following:

1) Go to your Hadoop installation location. I have installed it at /usr/share/hadoop-2.5.2

hadoop install location

2) Under /etc/hadoop thereis a file called hadoop-env.sh. In my case the file will be at /usr/share/hadoop-2.5.2/etc/hadoop

3) Open hadoop-env.sh in any editor of your choice (i will use vi) and locate the following entry:

#The java implementation to use.
export JAVA_HOME=${JAVA_HOME}

4)Edit the above line to specify your own JDK path. In my case the JDK1.6u45 is at /usr/share/jdk1.6.0_45 so my final entry should look like the following:
export JAVA_HOME=/usr/share/jdk1.6.0_45

5) Save the file. 

Note -In case you do not modify hadoop-env.sh to update the JAVA_HOME entry, your hadoop installation will use the default JDK specified in your JAVA_HOME environment variable. Make sure this default JDK is compatible with your Hadoop version. 

No comments:

Post a Comment