Set up Java on Ubuntu

Java can be downloaded from http://java.sun.com then move this file to /usr/local/


1. Installation


#sudo mv jdk-6u17-linux-i586.bin /usr/local/
#sudo chmod a+x /usr/local/jdk-6u17-linux-i586.bin
#sudo sh /usr/local/jdk-6u17-linux-i586.bin
#sudo update-alternatives --install "/usr/local/bin/java" "java" "/usr/local/jdk1.6.0_17/jre/bin/java" 1

2. Checking the version

#java -version


3. Set the Java Path
#sudo ln -s /usr/local/jdk1.6.0_17 /usr/local/jdk
#sudo pico /etc/profile


Insert these lines below at the end of the file.
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin




All done it complies properly. Check it out!

#javac


If you see a message that it cannot be found, reboot the computer.
Then execute javac command again to check out.

No comments:

Post a Comment