Tuesday, February 22, 2011

Java installation on Ubuntu

Installing java on a fresh Ubuntu Machine

=> Check for java-version : to know if java has been already installed
If NOT,

=> Execute the command
sudo apt-get install sun-java6-jre sun-java6-jdk

=> If you see something like below
E: Package sun-java6-bin has no installation candidate

=> Then open /etc/apt/sources.list and
add the below line at the EOF and save
deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse

=> then execute the command
sudo apt-get update

=> then execute the command
sudo apt-get install sun-java6-jre sun-java6-jdk

=> Follow the prompt and give correct response

=> Setting Environmental Variables
Open /etc/bash.bashrc file and append the below 4 lines at EOF and save it.
JAVA_HOME=/usr/lib/jvm/java-6-sun
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH


=> Create a Java File anywhere in your system, compile and run the program to
confirm successful java installation.

No comments:

Post a Comment