Archive for October 31, 2012

Casper Extension Attribute scripts to report Java browser plug-in info

October 31, 2012 Leave a comment

To help Casper admins identify which Macs should be getting the new Oracle Java 7 browser plug-in update, I’ve posted a couple of Casper extension attributes to my GitHub repo. The first one detects if a Mac’s Java browser plug-in in /Library/Internet Plug-Ins was supplied by Apple or Oracle. If no Java plug-in is detected, a No Java Plug-In Available message is displayed.


javaVendor=`/usr/bin/defaults read /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Info CFBundleIdentifier`

if [ "$javaVendor" = "" ]; then
elif [ "$javaVendor" = "" ]; then
elif [ "$javaVendor" = "" ]; then
        result="No Java Plug-In Available"

echo "<result>$result</result>"

The other one was shared on JAMF Nation by Christoph von Gabler-Sahm. This script detects the version of the active JavaAppletPlugin plug-in in /Library/Internet Plug-Ins.


# Christoph von Gabler-Sahm (email-redacted)
# 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="Not installed"

echo "<result>${EA_RESULT}</result>"

For Macs that have had the Java for OS X 2012-006 update installed, Christoph’s script above will report the following version status:

JavaInstallOnDemand: 14.5.0

Both scripts are available on my GitHub repo:

%d bloggers like this: