Check for installed Java on Linux and Solaris servers

Hi All,
I have looked around but am unable to find anything to help me find out about Java running on my servers. I would like to 1) Know if java is running on my system(s) and 2) know what version of java is running. Lastly would like to see if there are multiple versions installed on my system(s) if Java is indeed there.
I saw some stuff on Windows that looks at the registry and such but that does not help a nonWindows guy like myself.
Thanks in advance.

The following two examples of package inspectors would help to build what you need. They will return multiple values if more packages are present on the target system, as shown in the first example.

On Linux (rpm package)
Q: names of packages whose (name of it contains “java”) of rpm
A: java-1.7.0-openjdk
A: tzdata-java
A: java-1.6.0-openjdk

On Solaris
Q: names of pkginfos whose(name of it contains “JDK”) of pkgdb
A: JDK 8.0 64-bit Runtime Env. (1.8.0_181)
T: 32334

1 Like

I have the similar situation where i need to pull the jdk version across the board. but most of the jdk in our case is installed via tar ball that will defeat the purpose of “packages”. this might missed out lot of jdk version. Some of those jdk used by tomcate/jboss/or weblogic etc.

We have built custom solutions in the past that addressed these tar balls via:

  • custom task that list all filepaths on the system and stores matches into a single file (daily or weekly)
  • process that takes those matches and queries file versions/editions based on known versioning methods

This is still not 100% complete for all applications out there but some applications (like jres and jdks) have fairly standard methods for versioning.

That should be intrusive process to list all the files if the disk has lot of files?
Doesn’t the bigfix has “inventory” tool which does that similar thing?

The idea here would be to store all the matches in a file (not pathnames to all files). There is no good way of finding all instances of files like this without going though all the files on disk. The process can be as intrusive as you want it to be. Historically we have created scanners that can be dialed up or down based on the need.

Inventory solution does something similar but it’s a little more limited on Linux systems as file versioning is not supported by the filesystem. Hope that helps.