In this post i am going to teach you how to install java in you unix box in order to use hadoop
Before reading this please read Basic Unix command because knowledge of unix commands are required for installing java in unix.
Before reading this please read Basic Unix command because knowledge of unix commands are required for installing java in unix.
Dowload jdk 1.8 from the below link
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Download this file jdk-8u31-linux-x64.tar.gz
copy
it to any folder e.x /usr/local/java/
$ sudo mkdir
/usr/local/java
$ sudo chmod 777
/usr/local/java
$ sudo cp
/mnt/hgfs/sharedDrive/jdk-8u31-linux-x64.tar.gz to /usr/local/java
Untar it using the below command
$ sudo tar xvzf jdk-8u31-linux-x64.tar.gz
Edit
the system PATH file /etc/profile and add the following system variables
$ geany
/etc/profile
JAVA_HOME=/usr/local/java/jdk1.8.0_31
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
Inform your Ubuntu Linux system where
your Oracle Java JDK/JRE is located.
sudo update-alternatives
--install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_121/jre/bin/java" 1
sudo update-alternatives
--install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_121/bin/javac" 1
Inform your Ubuntu Linux system that
Oracle Java JDK/JRE must be the default Java.
sudo update-alternatives
--set java /usr/local/java/jdk1.8.0_121/jre/bin/java
sudo update-alternatives
--set javac /usr/local/java/jdk1.8.0_121/bin/javac
Reload your system wide PATH
/etc/profile by typing the following command:
$ . /etc/profile
Test to see if Oracle Java was
installed correctly on your system. Run the
following commands and note the version of Java
$ java -version
Above command will show you the java version if successfully installed