Hi all,
In this post I hope you to explain how
to install JDK 1.6 on your Ubuntu OS. There are several ways to achieve it, if
you are interested try to find other ways and tell others how it can do.
So first of all you have to download
Java Development Kit(JDK). Use following link to find it
- Then select Java SE 6u45's JDK download.
- Check the Agreement
- Select self-extracting binary file(.bin file)Make sure you select the correct compressed binaries for your system architecture 32-bit or 64-bit
- For example, if you are on Ubuntu Linux 32-bit operating system download 32-bit Oracle Java binaries.(for more instructions see)
- For example, if you are on Ubuntu Linux 64-bit operating system download 64-bit Oracle Java binaries.(for more instructions see)
Set execute permissions.
- in 32-bit run this command in terminal
- chmod a+x jdk-6u <version>-linux-i586.bin
- in 64-bit run this command in terminal
- chmod +x 6u <version>-linux-x64.bin
Copy your downloaded Jdk file where
you want to install it.
- I create install folder inside my home folder and then create java6 folder inside install folder then copy the file
Run the self-extracting binary.
Go to copied folder run,
cd
install/java6
in 32-bit run this command in terminal
./jdk-6u <version>-linux-i586.bin
in
64-bit run this command in terminal
./jdk-6u <version>-linux-x64.bin
when
exaction is finish set the path variable
Path setting.
Open .bashrc file,run this command in
terminal
sudo
gedit ~/.bashrc
Add lines bottom of the page
#Java configuration:(put a readability comment.this is only topic if you don't want it, ignore this line)
export JAVA_HOME=/home/hal/install/java6/jdk1.6.0_45
(setting environmental variable for Java.this is the path
of jdk1.6.0_45 folder change it as yours )
export
PATH=$JAVA_HOME/bin:$PATH
(setting path variable for java bin folder)
Then save the file and source it ,run
this command in terminal
source
~/.bashrc
Close the file(ctrl+c) run this
command in terminal
java
-version
It will give you following screen