java jdk

info: How to install java on Ubuntu.

Posted on Updated on

JAVAJava is a object-oriented computer programming language developed by James Gosling  at Sun Microsystems and released in 1995 lated it has been migrated to

Oracle systems. The code that can runs on one platform does not need to be recompiled.

Ubuntu

Install oracle java 7 in ubuntu 12.04
Here I have described about one of the easiest installation method of Oracle-JAVA on Ubuntu using JAVA repository. for more information : http://en.wikipedia.org/wiki/Java_(programming_language)

Open the terminal and run the following commands

# java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12.04.1)
OpenJDK Server VM (build 20.0-b12, mixed mode)

# sudo add-apt-repository ppa:webupd8team/java
# sudo apt-get update
# sudo apt-get install oracle-java7-installer

Now check the new updated verison

# java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)

 

sdf

Check the installation directory:

anand@desktop:~$ ll /usr/lib/jvm/java-7-oracle/
total 19720
drwxr-xr-x 8 root root 4096 May 3 09:32 .
drwxr-xr-x 6 root root 4096 May 3 09:32 ..
drwxr-xr-x 2 root root 4096 May 3 09:32 bin
-r--r--r-- 1 root root 3339 May 3 09:32 COPYRIGHT
drwxr-xr-x 4 root root 4096 May 3 09:32 db
drwxr-xr-x 3 root root 4096 May 3 09:32 include
drwxr-xr-x 5 root root 4096 May 3 09:32 jre
drwxr-xr-x 3 root root 4096 May 3 09:32 lib
-r--r--r-- 1 root root 40 May 3 09:32 LICENSE
drwxr-xr-x 4 root root 4096 May 3 09:32 man
-r--r--r-- 1 root root 114 May 3 09:32 README.html
-rw-r--r-- 1 root root 443 May 3 09:32 release
-rw-r--r-- 1 root root 19838528 May 3 09:32 src.zip
-rw-r--r-- 1 root root 123324 May 3 09:32 THIRDPARTYLICENSEREADME-JAVAFX.txt
-r--r--r-- 1 root root 172252 May 3 09:32 THIRDPARTYLICENSEREADME.txt

 

That’s all 🙂

Advertisements

Howto: Installing,Upgrading JAVA on Centos,Fedora,Ubuntu,RHEL5

Posted on

Download JAVA and follow the below installtion steps.

Use Java JDK absolute version (/usr/java/jdk1.7.0_03)

## java ##
alternatives --install /usr/bin/java java /usr/java/latest/bin/java 20000

## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/latest/bin/javaws 20000

## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/lib/i386/libnpjp2.so 20000

## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000


Use Java JRE latest version (/usr/java/latest)

## java ##
alternatives --install /usr/bin/java java /usr/java/latest/bin/java 20000

## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/latest/bin/javaws 20000

## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/lib/i386/libnpjp2.so 20000

## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000

 

 

Check current java, javac, javaws and libjavaplugin.so versions

 

java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)

javaws
Java(TM) Web Start 10.0.0.4-fcs
[...]

javac -version
javac 1.7.0_03


Swap between OpenJDK and Sun/Oracle Java JDK/JRE 6 and 7 versions

JAVA

alternatives --config java

There are 5 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /usr/java/jdk1.6.0_24/jre/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
 + 3           /usr/java/jdk1.6.0_26/jre/bin/java
   4           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
   5           /usr/java/jdk1.7.0_03/jre/bin/java

Enter to keep the current selection[+], or type selection number: 5

Note: java with [+] is currently on use

javaws

alternatives --config javaws

There are 3 programs which provide 'javaws'.

  Selection    Command
-----------------------------------------------
*  1           /usr/java/jdk1.6.0_24/jre/bin/javaws
 + 2           /usr/java/jdk1.6.0_26/jre/bin/javaws
   3           /usr/java/jdk1.7.0_03/jre/bin/javaws

Enter to keep the current selection[+], or type selection number: 3

Note: java with [+] is currently on use

libjavaplugin.so (32-bit)

alternatives --config libjavaplugin.so

There are 3 programs which provide 'libjavaplugin.so'.

  Selection    Command
-----------------------------------------------
*  1           /usr/java/jdk1.6.0_24/jre/lib/i386/libnpjp2.so
 + 2           /usr/java/jdk1.6.0_26/jre/lib/i386/libnpjp2.so
   3           /usr/java/jdk1.7.0_03/jre/lib/i386/libnpjp2.so

Enter to keep the current selection[+], or type selection number: 3.

javac

alternatives --config javac

There are 3 programs which provide 'javac'.

  Selection    Command
-----------------------------------------------
*  1           /usr/java/jdk1.6.0_24/bin/javac
 + 2           /usr/java/jdk1.6.0_26/bin/javac
   3           /usr/java/jdk1.7.0_03/bin/javac

Enter to keep the current selection[+], or type selection number: 3

Note: java with [+] is currently on use


Post-Installation Setup

Add JAVA_HOME environment variable to /etc/profile file or $HOME/.bash_profile file

Java JDK and JRE latest version (/usr/java/latest)

## export JAVA_HOME JDK/JRE ##
export JAVA_HOME="/usr/java/latest"

Java JDK and JRE absolute version (/usr/java/jdk1.7.0_03)

## export JAVA_HOME JDK ##
export JAVA_HOME="/usr/java/jdk1.7.0_03"

## export JAVA_HOME JRE ##
export JAVA_HOME="/usr/java/jre1.7.0_03"