Friday, August 9, 2013

Installing Oracle JDK 7 with Netbeans Installer

I have installed Oracle JDK 7 using a special version of Netbeans installer that included JDK7.

1. RESOURCES
Oracle: http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. INSTALLATION
I went to the Oracle Java downlaod page: http://www.oracle.com/technetwork/java/javase/downloads/index.html
Click "JDK 7 + Netbeans" icon.

And I download one for my [X]Ubuntu 64bit: jdk-7u25-nb-7_3_1-linux-x64.sh

I made the downloaded file executable and ran it as root to install both JDK and Netbeans.
$ cd Downloads/
$ chmod a+x jdk-7u25-nb-7_3_1-linux-x64.sh 
$ sudo ./jdk-7u25-nb-7_3_1-linux-x64.sh
I specified /usr/lib/jvm/ as JDK installation location because all installed Java versions were there.

Test the installation.
$/usr/lib/jvm/jdk1.7.0_25/bin/java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)


3. MAKING ORACLE JDK 7 AS DEFALT JAVA

I downloaded and used galternatives to swich default Java.
$ sudo apt-get install galternatives
$ gksu galternative
See my post "Installing Alternatives Configurator (galternatives) on Ubuntu".

Test the default.
$ cd ~
$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Thursday, August 8, 2013

Installing Alternatives Configurator (galternatives) on Ubuntu

I have installed Alternatives Configurator(galternatives), a GUI front end for update-alternatives. And I used it to add Oracle JDK to Java alternatives and made it default Java because I installed JDK manually.

1. RESOURCES
Debian Admin: Galternatives – graphical setup tool for Alternatives Configuration in Ubuntu
Ask Ubuntu: How do I make java default to a manually installed JRE/JDK?

2. INSTALLATION
$ sudo apt-get install galternatives

3. LAUNCH TO ADD ORACLE JDK AND MAKE IT DEFAULT
$ gksu galternatives

4. CHECK JAVA VERSION
Before the Java default change using galternative, my Java version was OpenJDK 1.7.
$ java -version
java version "1.7.0_21"
OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-1ubuntu1)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
After the change, my Java version is now Oracle JDK SE 1.7.
$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

5. JAVA_HOME SETTING
Be sure to have JAVA_HOME set in .bashrc.
export JAVA_HOME=/usr/lib/jvm/default-java