Detecting the Oracle-supplied Java 7 browser plug-in

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-31-2012 06:56 AM
Does anyone have an extensions attribute for detecting if someone is using the Oracle-supplied Java 7 browser plug-in? I'm trying to set up a smart group that identifies these Macs on my network.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-31-2012 07:19 AM
Here's what I'm using for an Extension Attribute to detect Apple Java version
https://gist.github.com/3987294
I'm scoping it to "Java Version is 14.5.0"
I just re-read the question, for Oracle, I put together a quick and dirty Extension Attribute
https://gist.github.com/3987395
Suggestions and improvements always welcome

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-31-2012 07:26 AM
I may have a start here, will keep working on it. A way to detect Apple vs Oracle Java:
defaults read /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Info CFBundleIdentifier
With Apple Java, it'll return com.apple.java.JavaAppletPlugin. For Oracle, it returns com.oracle.java.JavaAppletPlugin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-31-2012 07:52 AM
I am currently using the following script for differentiation:
#!/bin/bash
# Christoph von Gabler-Sahm (christoph.gabler-sahm@computacenter.com)
# Version 1.0
# checks installed version of Java Applet Plugin
# returns values like "Not installed", "JavaInstallOnDemand: 14.5.0", "JavaJDK16: 14.5.0" or "Java 7 Update 09"
PLUGINPATH="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin"
# Plugin version
S_VERSION=$( /usr/bin/defaults read "${PLUGINPATH}/Contents/Info" CFBundleShortVersionString 2>/dev/null )
# JavaInstallOnDemand or empty
S_PROJECT=$( /usr/bin/defaults read "${PLUGINPATH}/Contents/version" ProjectName 2>/dev/null )
if [[ -e "${PLUGINPATH}" ]]; then
if [[ "${S_PROJECT}" == "" ]]; then
EA_RESULT="${S_VERSION}"
else
EA_RESULT="${S_PROJECT}: ${S_VERSION}"
fi
else
EA_RESULT="Not installed"
fi
echo "<result>${EA_RESULT}</result>"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-31-2012 08:02 AM
Nice script! Thanks for sharing!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 10-31-2012 12:02 PM
Thanks, cvgs! I'm using your script and it works great for pulling the version. I've also put together an script for determining quickly who's the vendor (Apple or Oracle):
#!/bin/bash
javaVendor=`/usr/bin/defaults read /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Info CFBundleIdentifier`
if [ "$javaVendor" = "com.oracle.java.JavaAppletPlugin" ]; then
result=Oracle
elif [ "$javaVendor" = "com.apple.java.JavaAppletPlugin" ]; then
result=Apple
elif [ "$javaVendor" = "" ]; then
result="No Java Plug-In Available"
fi
echo "<result>$result</result>"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 12-04-2012 02:30 PM
Note that the script does not work on Snow Leopard computers with Java 1.6 Update 9 installed. There is no JavaAppletPlugin.plugin in the /Library/Internet Plug-Ins folder:
$ pwd
/Library/Internet Plug-Ins
$ ls -d *Java
JavaPlugin2_NPAPI.plugin JavaPluginCocoa.bundle <<< No JavaAppletPlugin.plugin!
$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.6.8*
BuildVersion: 10K549
