Thursday, December 20, 2012

How to Configure Java-JDK


Step 1: Download JDK from http://www.java.com. I got JDK version 7 in rpm format. 
-rw-r--r-- 1 root root 124582988 Sep 17 15:19 /tmp/jdk-7u6-linux-x64.rpm 
 $ ls *.rpm  jdk-7-linux-x64.rpm 

Step 2: Install the RPM. 
[root@server2 sandbox]# rpm -i jdk-7-linux-x64.rpm  Unpacking JAR files…  rt.jar…  jsse.jar…  charsets.jar…  tools.jar…  localedata.jar… 
By default Java will be installed to /usr/java/jdk1.7.0/ 

Step 3:  Add this new java to the alternatives configuration & Update the java alternatives 
  • alternatives - -install /usr/bin/java java /usr/java/jdk1.7.0/bin/java 2 
[root@myhost lib]# alternatives --config java  There are 2 programs which provide 'java'.    Selection    Command ----------------------------------------------- *+ 1           /usr/lib/jvm/java-1.7.0-oracle-1.7.0.5.x86_64/jre/bin/java    2           /usr/java/jdk1.7.0_06/bin/java  Enter to keep the current selection[+], or type selection number: 2    
Step 4: Now verify the java version 

[root@dsa523 lib]# java -version java version "1.7.0_06" Java(TM) SE Runtime Environment (build 1.7.0_06-b24) Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)  
Step 5: Update DB and check locate command 
[root@myhost lib]# locate tools.jar [root@myhost lib]# updatedb [root@myhost lib]# locate tools.jar /usr/java/jdk1.7.0_06/db/lib/derbytools.jar /usr/java/jdk1.7.0_06/lib/tools.jar /usr/java/jdk1.7.0_06/lib/visualvm/visualvm/modules/com-sun-tools-visualvm-tools.jar 

No comments:

Post a Comment