#java -version
or
#java -showversion
It shows something like:
java version "1.4.2.0"
Java(TM) SE Runtime Environment .....
Obtain rpm. In my example, I got jdk-7u3-linux-x64.rpm
Install it:
#rpm -ivh jdk-7u3-linux-x64.rpm
###############################100%
Find out rpm installation location:
# rpm -qi jdk-1.7*
Name : jdk Relocations: /usr/java
Version : 1.7.0_03 Vendor: Sun Microsystems, Inc.
Release : fcs Build Date: Fri 20 Jan 2012 03:30:26 PM EST
Install Date: Sun 01 Apr 2012 08:23:26 AM EDT Build Host: jdk7-lin-amd64
Group : Development/Tools Source RPM: jdk-1.7.0_03-fcs.src.rpm
Size : 117905566 License: http://java.com/license
Signature : (none)
Packager : Java Software
URL : URL_REF
Summary : Java(TM) Platform Standard Edition Development Kit
Description :
The Java Platform Standard Edition Development Kit (JDK) includes both
the runtime environment (Java virtual machine, the Java platform classes
and supporting files) and development tools (compilers, debuggers,
tool libraries and other tools).
The JDK is a development environment for building applications, applets
and components that can be deployed with the Java Platform Standard
Edition Runtime Environment.
Now, we know that it is in /usr/java/jdk1.7.0_03
Installing alternatives for java:
# /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_03/bin/java 2
Configuring java programs (in my case, I enter 2 in selection):
# /usr/sbin/alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
2 /usr/java/jdk1.7.0_03/bin/java
Enter to keep the current selection[+], or type selection number: 2
Now, I check for my java version:
# 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)
Thank you.
No comments:
Post a Comment