/build/static/layout/Breadcrumb_cap_w.png

Java, OS X, and your K1000

Preamble

The first thing to understand about Oracle Java and systems running OS X 10.7 and above is that it is not an Application, so it doesn't really show up in the Software module (although two components do). The pieces of JAva that I care about are the PreferencePane and the Internet Plug-in. Also, Oracle didn't quite follow Apple's rules, they kinda faked it. 

Java is Special. 

Another item is that for OS X versions before 10.7, Java was built in; after that it is not and needs to be added. 

Further complicating things is that Apple's XProtect. XProtect is a FIle Quarentine implementation that blocks known maleware (or vulnerable versions of some applications). It is built in to OS X 10.8 and later. If you are running updated Java (1.7_55 +) and at least Snow Leopard (Mavericks is free) it shouldn't effect you in a bad way. If you have a need to run Java 1.6, then you may want to check this thread: 


http://managingosx.wordpress.com/2013/01/31/disabled-java-plugins-xprotect-updater/

http://managingosx.wordpress.com/2013/02/01/more-thoughts-on-xprotect-updater/

  http://managingosx.wordpress.com/2013/02/04/still-more-on-the-xprotect-updater/

-----------


Determining if JAVA is installed and if so, what version


Because Java is not an Application, but rather a set of plug-ins, determining the presence and the version of two compnents is key. 

	\Library\PreferencePanes\JavaControlPanel.prefPane
\Library\Internet Plug-ins\JavaAppletPlugin.plugin

To make things more complicated, the PreferencePane is a link, not a real file. It links to:

	/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/deploy/JavaControlPanel.prefPane	

So, since that is a sub section of the JavaAppletPlugin.plugin, it is the key. 

To determine the version of the Plug-In, you can use the Get Info feature of the finder. From the command line that best way to do this is to grab it out of the Info.plist file that is found within the Plug-in bundle. 

	/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Info.plist 	

Unfortunately, this too is a link. So, the best way to determine the current version seems to be to use built in queries on the system like PlistBuddy or Defaults : 

	/usr/libexec/PlistBuddy -c "print :CFBundleVersion" "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Info.plist"

OR

	/usr/bin/defaults read /Library/Internet\ Plug-ins/JavaAppletPlugin.plugin/Contents/Info.plist CFBundleVersion


Either of which could be used as a Custom Inventory Return 

	ShellCommandTextReturn(/usr/libexec/PlistBuddy -c "print :CFBundleVersion" "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Info.plist")

Note: Using 'PlistValueReturn' to do the same thing doesn't work because the link points to either 'Enabled.plist' or 'Disabled.plist' depending on the state. 

This would work if it is Enabled...

	PlistValueReturn(/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Enabled.plist, CFBundleVersion, TEXT)	

Better yet, throw a small script on the systems and then run the script with the CI (save in /usr/local/bin/java_ver.sh)


#!/bin/bash
if [ -f "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Enabled.plist" ] ; then VERSION=$( defaults read "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Enabled.plist" CFBundleVersion )
else [ -f "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Disabled.plist" ]
   VERSION="Not installed."
fi
echo "$VERSION"

Then build out your CIR:


	ShellCommandTextReturn(/bin/bash /usr/local/bin/java_ver.sh)

Installing Java 1.7_60 b19

OK, so know we know what version is installed. If you want to make a Managed Install for Java the next step would be to make a specific Software Record for that specific version of Java. For this example I will talk about Java Standard Version 7 Update 60 (CFBundleVersion returns 1.7.60.19)


	PlistValueEquals(/Library/Internet\ Plug-ins/JavaAppletPlugin.plugin/Contents/Enabled.plist, CFBundleVersion, TEXT, 1.7.60.19) OR	PlistValueEquals(/Library/Internet\ Plug-ins/JavaAppletPlugin.plugin/Contents/Disabled.plist, CFBundleVersion, TEXT, 1.7.60.19)


Select all your 10.7 and above Operating Systems

Browse to FIle:  jre-7u60-macosx-x64.dmg




The Managed Install in Distribution is stadard for OS X. Just let it do it. :)


Bonus

Option Disable Java Auto Update: 

You could add this to the script that returns the version and it will turn off the auto update feature in Java. 

	defaults write /Library/Preferences/com.oracle.java.Java-Updater JavaAutoUpdateEnabled -bool false



Resources:


Java FAQ (Oracle):

    http://java.com/en/download/faq/java_mac.xml

XProtect re-Enable Java 6 & 7:

    https://gist.github.com/rtrouton/5560098

Managing Oracle Java Exception Site List:

    http://derflounder.wordpress.com/2014/01/16/managing-oracles-java-exception-site-list/



Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ