Oracle Java version extension attribute

nkalister
Valued Contributor

Hello jamfnation- does anyone have an extension attribute that can report the Oracle java version in addition to Apple's versions?
All the extension attributes I've seen are based on the java -version bash command, which only seems to return information about the apple-supplied JRE, not the one from Oracle.

1 ACCEPTED SOLUTION

stevewood
Honored Contributor II
Honored Contributor II

If you pick through this post:

https://jamfnation.jamfsoftware.com/discussion.html?id=5641#respond

You'll find this link to Rich Trouton's blog:

http://derflounder.wordpress.com/2012/10/31/casper-extension-attribute-scripts-to-report-java-browse...

I'm using Rich's method to identify the vendor, and the method he links to to identify the version.

View solution in original post

3 REPLIES 3

stevewood
Honored Contributor II
Honored Contributor II

If you pick through this post:

https://jamfnation.jamfsoftware.com/discussion.html?id=5641#respond

You'll find this link to Rich Trouton's blog:

http://derflounder.wordpress.com/2012/10/31/casper-extension-attribute-scripts-to-report-java-browse...

I'm using Rich's method to identify the vendor, and the method he links to to identify the version.

nkalister
Valued Contributor

Perfect, thanks Steve!!

tlarkin
Honored Contributor

Hi Guys,

A bit late to the party here, but I came up with a solution for several customers to report every version of Java installed on their Macs, and then pump that into an EA.

#!/bin/bash

# set get numeric values of versions from the java framework folder
# grab integers only

javaVersions=$(/bin/ls /System/Library/Frameworks/JavaVM.framework/Versions | /usr/bin/grep '[0-9].[0-9]')

# now loop through the results and into an extension attribute

for i in ${javaVersions}; do

  echo "<result>${i}</result>"
  done

# now check for version 7

version7=$(/bin/ls /Library/Java/JavaVirtualMachines/)

if [[ ${version7} != "" ]]

  then /bin/echo "<result>${version7}</result>"

fi

exit 0

This was quick and dirty and on the fly but it seems to be what the customer wanted. So, hopefully this may help some of you. If you look at the java binary it is just a symbolic link to the current version in the framework folder, however when you install the newest Java it puts it in a different location and I think (have not verified this yet) it uses a totally different command line binary.

Hope this helps,
Tom