Saturday, April 30, 2011

Setting JAVA_HOME in Ubuntu

I have read lots of user posting at various pages and none of them would work. Finally, I found a way to do this correctly and hope this will help to some of you.

Follow the simple steps:

1. To set the environment variables :
    echo ‘export JAVA_HOME=/opt/jdk1.5.0_12′ > /etc/profile.d/jdk.sh
    echo ‘export PATH=$JAVA_HOME/bin:$PATH’ >> /etc/profile.d/jdk.sh

2. You have to source the file you just created by typing:
    source /etc/profile.d/jdk.sh

3. Test if Java environment is successfully installed by typing in this in the shell:
    java -version

No comments:

Post a Comment