I am trying to find retrieve property relevance to find the JDK version on Linux machines but no luck. I do not have BIgfix inventory in my org. If any one has created any retrieve property or analysis to find the JDK version for Linux machine, please help me .
@cmcannady, thanks for quick reply, i have checked all the available options but not able to find the JDK version.
Actually i have installed the JDK through tarball, and i am able to see the Java version manually but it’s difficult to check manually on every systems.
I am trying below relevance for the same but getting error.
Q: (names of it, pid of it, name of user of it|"", (pathname of image files of it) | (“no path”) ,(version of image files of it as string) | (“no version”) )of processes whose (name of it contains “java” or name of it contains “jre” or name of it contains “jdk” )
E: The operator “version” is not defined.
I don’t believe Linux file metadata contains version numbers. For Java, the simplest method I’ve found is to read the content of the RELEASE file, in a path relative to the running Java binary. I’ll see what I can dig up on that later today.
The above relevance is interrogating the processes inspector. This will only provide details when a Java process is running at the same time you’re executing your relevance query.
@JasonWalker answer is where I was heading. Java in general is difficult to inventory on Linux systems as many applications have embedded JDK/JRE.
@tyagi.j, can you advise if your organization enforces any requirements on Java versions, etc.?
Here’s a quick query to retrieve the Java version from the ‘release’ file. Try substituting in your ‘pathname of image file of it’ where I use a literal path here.
Q: concatenation of substrings separated by "%22" of following text of first "=" of lines containing "JAVA_VERSION" of file "release" of parent folder of parent folder of file "c:\program files\java\jre1.8.0_141\bin\java.exe"
A: 1.8.0_141
T: 1566
Thanks Jason, it’s working for me.
(exists ((folder “/var/opt/java_8”) whose (exists file “release” whose (preceding text of lasts “%22” of following text of firsts “JAVA_VERSION=%22” of lines of it as trimmed string contains “1.8.0_271”) of it)))