JAVA Installation in Ubuntu version

                                                  

I have a 64 bit version of Ubuntu 12.04 LTS installed, so the instructions below only apply to this OS.
Download the Java JDK from

1.           Click Accept License Agreement
2.           Click jdk-6u45-linux-x64.bin
3.           Login to Oracle.com with your Oracle account
4.           Download the JDK to your ~/Downloads directory
5.           After downloading, open a terminal, then enter the following commands.

cd ~/Downloads
chmod +x jdk-6u45-linux-x64.bin
./jdk-6u45-linux-x64.bin
Note:
The jvm directory is used to organize all JDK/JVM versions in a single parent directory.
sudo mkdir /usr/lib/jvm
sudo mv jdk1.6.0_45 /usr/lib/jvm
The next 3 commands are split across 2 lines per command due to width limits in the blog’s theme.



sudo update-alternatives --install "/usr/bin/java" "java" \
"/usr/lib/jvm/jdk1.6.0_45/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" \
"/usr/lib/jvm/jdk1.6.0_45/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" \
"/usr/lib/jvm/jdk1.6.0_45/bin/javaws" 1
sudo update-alternatives --config java

You will see output similar to the following (although it’ll differ on your system). Read through the list and find the number for the Oracle JDK installation (/usr/lib/jvm/jdk1.6.0_45/bin/java)

There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      auto mode
  1            /usr/lib/jvm/jdk1.6.0_45/bin/java                            1         manual mode
  2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode

On my system I did the following (change the number that is appropriate for your system):
Press 1 on your keyboard, then press Enter.

sudo update-alternatives --config javac

Follow steps similar to those listed above if you are presented with a list of options. In my case, I had not previously installed the OpenJDK javac binary, so my output looked like the following:

There is only one alternative in link group javac: /usr/lib/jvm/jdk1.6.0_45/bin/javac
Nothing to configure.
sudo update-alternatives --config javaws

As with javac, I did not have the OpenJDK version of javaws installed, so my output was simple. However, if you get a list of options, just type in the number of the path to the Oracle javaws command, and press Enter.

There is only one alternative in link group javaws: /usr/lib/jvm/jdk1.6.0_45/bin/javaws
Nothing to configure.

As a final step, let’s test each of the commands to ensure everything is setup correctly.

java -version

The output should be: java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

javac -version
The output should be: javac 1.6.0_45

javaws -version
The output should be:
Java(TM) Web Start 1.6.0_45

which is followed by a long usage message.

Create the JAVA_HOME environment variable

Open a terminal, then enter the following commands:
sudo vi /etc/environment

Enter the following at the bottom of the file:
JAVA_HOME="/usr/lib/jvm/jdk1.6.0_45"

Type the following commands to finish the setup and verify that everything is setup correctly.
source /etc/environment
echo $JAVA_HOME

You should see the following output:
/usr/lib/jvm/jdk1.6.0_45

Lastly, verify that JAVA_HOME is set correctly for the sudo user:
sudo env | grep JAVA_HOME

That’s it, the JDK 6.0 update 45 is installed.

Soon I am going to post JAVA 7 installation
For any more issues that you observe please notify here..


HAPPY Hadooping !!

Comments

Popular posts from this blog

Cloudera Data Hub: Where Agility Meets Control

Architectural Patterns for Near Real-Time Data Processing with Apache Hadoop

How-to: Use Parquet with Impala, Hive, Pig, and MapReduce

Big Data Trendz