OrangeScape Developer Community

A community for Application Developers on OrangeScape's Platform-as-a-Service

How to install JDK in *nix and set the JAVA_HOME and PATH environment variables

The following is the procedure to install SUN JDK in *nix.

First go to sun's website and downloaded the .bin installation file. (not the rpm one). if you want to install jdk in a system wide accesible place like /usr/local from where all users can access then you will have to become super user before starting this procedure. you can either change to super user using su, or execute with sudo. To become super user, in terminal type.


and enter the super user password when prompted.
If you want to install it only for yourself, then you don't have to become a super user, you can execute the commands in any directory where you have write permission.

now copy the .bin file to the place you want to install (for eg: /usr/local), then enable executable permissions for the file and the execute the file. that is it. it will get installed into current directory/jdk (for eg: /usr/local/jdk1.5.0_15)

I am listing the exact steps which is as follows.

Phoniex:/home/anbarasan#cp /home/dsl/jdk-1_5_0_15-linux-i586.bin /usr/local/
Phoniex:/home/anbarasan#cd /usr/local
Phoniex:/usr/local#chmod a+x jdk-1_5_0_15-linux-i586.bin
Phoniex:/usr/local#./jdk-1_5_0_15-linux-i586.bin (dot slash fileName dot bin)

after this, go to the home directory and edit the .bashrc or .bash_profile (depending on your flavour) file to set the java_home and path variables, so as to access the commands directly in command prompt.

in terminal enter

Phoniex:~# exit
anbarasan@Phoniex:~$vi .bashrc (or) .bash_profile

then at the end of the file add the following lines.

export JAVA_HOME=/usr/local/jdk1.5.0_15

save the file and exit, and do a machine restart

to check if the settings have taken effect. You can test it this way.

in terminal type

anbarasan@Phoniex:~$echo $JAVA_HOME

this will return the path where you installed the jdk.

anbarasan@Phoniex:~$ echo $JAVA_HOME

if it returns blank, then it is not initialised properly.

The setting of JAVA_HOME and PATH Environmental Variable has to be done for each and every user seperately.

Views: 86


You need to be a member of OrangeScape Developer Community to add comments!

Join OrangeScape Developer Community

Comment by Balaji Venugopal on November 4, 2008 at 11:39am
Anbu, Can you give the real time demo for this?

© 2018   Created by OrangeScape Technologies.   Powered by

Badges  |  Report an Issue  |  Terms of Service