Friday 20 December 2013

Find to install Java6 on Ubuntu

STEP 1: DOWNLOAD ORACLE JAVA.

When new versions of Java are released, they are featured on the main Java download page.
If Java 6 update 45 is no longer featured, you can find the download by following the Previous Releases link found on the main download page.
Open the Java download page
in your browser and download both jdk-6u45-linux-i586.bin and jre-6u45-linux-i586.bin
Make a note of the folder to which you downloaded the files.

STEP 2: CREATE THE INSTALLATION FOLDER.

The usr/lib/jvm is the default installation location of the Java JDK and the Java JRE. Enter the following command in your console:

1
sudo mkdir -p /usr/lib/jvm
The –p option ensures that all folders in the mkdir path are created.

STEP 3: NAVIGATE TO THE FOLDER TO WHICH YOU DOWNLOADED THE JAVA INSTALLATION FILES.

If you downloaded the files to your Home folder, you can use the following command:
1 cd ~/

STEP 4: MOVE THE DOWNLOADED FILES TO THE INSTALLATION FOLDER.
1 sudo mv jdk-6u45-linux-i586.bin /usr/lib/jvm
2 sudo mv jre-6u45-linux-i586.bin /usr/lib/jvm

STEP 5: CHANGE TO THE INSTALLATION FOLDER.
1 cd /usr/lib/jvm

STEP 6: MAKE THE DOWNLOADED BINARIES EXECUTABLE.
1 sudo chmod u+x jdk-6u45-linux-i586.bin
2 sudo chmod u+x jre-6u45-linux-i586.bin

STEP 7: EXTRACT BOTH COMPRESSED BINARY FILES.
1 sudo ./jdk-6u45-linux-i586.bin
2 sudo ./jre-6u45-linux-i586.bin

STEP 8: CHECK YOUR EXTRACTED FOLDER NAMES.

1 ls -l
Response:
1 jdk1.6.0_45
2 jre1.6.0_45

STEP 9: INFORM UBUNTU WHERE YOUR JAVA INSTALLATION IS LOCATED.
1 sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.6.0_45/bin/java" 1
2 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_45/bin/javac" 1

STEP 10: INFORM UBUNTU THAT THIS IS YOUR DEFAULT JAVA INSTALLATION.
1 sudo update-alternatives --set java /usr/lib/jvm/jre1.6.0_45/bin/java
2 sudo update-alternatives --set javac /usr/lib/jvm/jdk1.6.0_45/bin/javac

STEP 11: UPDATE YOUR SYSTEM-WIDE PATH.
Edit your /etc/profile file using:

1 sudo nano /etc/profile
Add the following entries to the bottom of the file:

1 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
2 export JAVA_HOME
3 export PATH
Save your changes using CTRL + X.

STEP 12: RELOAD YOUR SYSTEM-WIDE PATH.
1 . /etc/profile

STEP 13: REBOOT YOUR UBUNTU SYSTEM.
1 sudo reboot

STEP 14: TEST YOUR NEW INSTALLATION.
1 java –version
Response:
1 java version "1.6.0_45"
2 Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
3 Java HotSpot(TM) Client VM (build 20.12-b01, mixed mode, sharing)

1 javac –version
Response:
1 javac 1.6.0_45

No comments:

Post a Comment