Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

how to find the running java version

rajesh73
Super Advisor

how to find the running java version

in my server java 1.3 and java 1.4 two version are availble.

$cd /opt
$ls
output --java 1.3,java 1.4

how to find the which java version running in server.
5 REPLIES
Duncan Edmonstone
Honored Contributor

Re: how to find the running java version

Well either version could be used... if you wanted to see which version was in use *right now* then something like:

find /opt/java* -name java -type f -exec fuser {} \;

Would show any processes that have the java executable open right now.

Of course that doesn't mean that something might not start at another point in time and use the other java version...

What are you trying to acheive here?

HTH

Duncan

HTH

Duncan
Hakki Aydin Ucar
Honored Contributor

Re: how to find the running java version

if you are looking for a particular application ,you can check the software release and find which java version it needs from its documents.

For example;
swlist -l product | grep -i java
swlist -l product | grep -i your_application

and sometimes it is already in your environment like my DataProtector 6.11 ;
# set |grep -i java
DP_JAVA_DIR=/opt/java6/jre/


Manix
Honored Contributor

Re: how to find the running java version

To find the java version running try :-
# java -version

every java install will create a new directory
under /opt/.. ,

you can see which java to check the current path settings.

Thanks
Manix
HP-UX been always lovable - Mani Kalra
Alzhy
Honored Contributor

Re: how to find the running java version

Rajesh,

You would need to fuly qualify your question. But if your situation is such that you have "java" processes running (via ps or top or glance) AND you are wondering what version(s) of java those are - then let us know.

On any UNIX/Linux OS these days.. there could be several versions of Java running - either bundled with the OS or installed along with other software kits like Oracle, your SAN agents, performancwe collectors, etc.

Generally what I do is to use "lsof" to seek out from what path/directory the runing java process point to. Then use "java -version" on the path to find out the version.

Hope this helps.
Hakuna Matata.
Zakleadz
Occasional Visitor

Re: how to find the running java version

From the root directory, goto below path

/opt/java6/bin

Note** java6 is my version. It may be same or different based on the java version you have installed

From here, run the below command.

#   ./java -version

You can find the similar output as given below.

Output:

Java(TM) SE Runtime Environment (build 1.6.0.06-jinteg_20_jan_2010_05_50-b00)
Java HotSpot(TM) Server VM (build 14.3-b01-jre1.6.0.06-rc1, mixed mode)