Monday, December 10, 2012

JDK Installation - Ubuntu Distribution

1) Download the bin file from http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html (JDK 5.0 Update 13, Linux self-extracting file) to /usr/local/ or another directory.

Change permisions using chmod.
chmod +x jdk-1_5_0_12-linux-i586.bin

2 ) Then we need to configure JAVA

We have 2 options here, use the console or a GUI.

A) Console approach.

sudo update-alternatives --install /usr/bin/java java /home/psabbate/dev/java/jdk1.7.0_XX/bin 70

Command: update-alternatives 
Installation Param: --install
Link Path: /usr/bin/java
Link Name: java
JDK Path: /home/psabbate/dev/java/jdk1.7.0_XX/bin
Priority: 70 (The higher, the best)
Then execute
sudo update-alternatives --config java

B) GUI approach

Use galternatives

sudo aptitude install galternatives
sudo galternatives

Search “java” and go to the JDK directory.

3 ) Enviroment Variables:

Please Edit
sudo vi /etc/bash.bashrc:

Add at the bottom of the file
export JAVA_HOME=(JDK Path)
export PATH=$JAVA_HOME/bin:$PATH