Sunday, 3 February 2013

Java Installation on Ubuntu 12.04


1.Installation OpenJDK
Download and Install OpenJDK and Oracle JDK on ubuntu 12.04
sudo apt-get install openjdk-7-jre
If your system has more than one version of Java, configure which one your system
uses be entering the following command in a terminal window
sudo update-alternatives --config java
Select the option corresponding to desired java version 2.
2.Installation of oracle JDK
  • Download Oracle JDK
Go to download site http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u4-downloads-1591156.html
and select jdk-7u4-linux-x64.tar.gz for download.
  • Extract and Install
tar -xvf jdk-7u2-linux-x64.tar.gz (64bit)
JDK 7 package is extracted into ./jdk1.7.0_02 directory
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/softwares-linux/jdk1.7.0_04/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/softwares-linux/jdk1.7.0_04/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/softwares-linux/jdk1.7.0_04/bin/javaws" 1
  • Configure Default Java Configuration
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
Check the version of you new JDK 7 installation
Reference : http://roshanbook.wordpress.com/2012/02/18/installing-oracle-jdk-7-on-ubuntu/
3.NetBeans IDE installation
Go  to Netbeans IDE download page http://netbeans.org/downloads/
select the suitable installation .
This will download netbeans-7.1.2-ml-linux.sh file
Execute the script
sudo sh ./netbeans-6.5-ml-java-linux.shcript
After the installation has completed set up soft links to the library and provide suitable permission
ln -s /opt/softwares-linux/netbeans-7.1.2/bin/netbeans /usr/local/bin/netbeans

Reference : https://help.ubuntu.com/community/Netbeans

before launching change the java reference to openjdk