Posted on 04-30-2012 11:53 AM
The latest java update disables the checkbox in Java preferences for "enable applet plugin and web start applications." Also as part of the latest Java update, Apple said that even if you enable the checkbox, they would disable it for you if the doesn't use java after so much time.
Is there an MCX setting to check the box? We have a bunch of web based apps used in elem schools that require java that having them enabled the plugin and restart the browser is a pain.
I tried using a composer snapshot to catch the plist without luck so far.
Posted on 04-30-2012 12:11 PM
http://derflounder.wordpress.com/2011/08/31/activate-java-web-plug-ins-setting-in-10-7-from-the-command-line/
there is a way to create it manually, add to user template etc.
Posted on 04-30-2012 01:06 PM
I created a package with the .plist ByHost File and set it to FUT to install during imaging, but it doesn't seem to be working.
JAMF should be able to handle this like it does other ByHost files, right (at image time)?
Posted on 04-30-2012 01:17 PM
I created a script that I run at every user logon. It's based on some code from someone else doing the same thing.
#!/bin/sh
# Only for Mac OS 10.7
if [ `sw_vers -productVersion | awk -F. '{ print $2 }'` -eq 7 ]; then
# Set the UUID for the ByHost File Naming
MAC_UUID=`system_profiler SPHardwareDataType | grep "Hardware UUID" | awk '{print $3}'`
if [ `echo $MAC_UUID | cut -c 1-24` == "00000000-0000-1000-8000-" ]; then
MAC_UUID=`echo $MAC_UUID | cut -c 25-36`
fi
# Set the "Enable applet plug-in and Web Start Applications" setting in Java Prefs
echo "UUID for ByHost file naming set to $MAC_UUID"
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real $(( $(date "+%s") - 978307200 ))" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
chown $3 /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.$MAC_UUID.plist
echo "Java web plug-in enabled"
fi
Posted on 04-30-2012 01:18 PM
Maybe try the Oracle java update http://www.oracle.com/us/corporate/press/1603497?
Posted on 04-30-2012 01:31 PM
Thanks for the script. According to a few security sites, supposedly will only disable itself after 35 days of non Java use, but if that countdown starts with the image date that's not so helpful.
It's a shame you can't run the script once a month per user.
Edit: the package to set the ByHost file setting did work - I had another package fighting with it. I assume I'll still have to use the script in this thread though because after 35 days it will be unchecked again.
Posted on 04-30-2012 08:57 PM
I use Rich's script as a login script or along with the JAVA update to enable the plugin after the update.
#!/bin/sh
# Set the the "Enable applet plug-in and Web Start Applications" setting for Java in your Mac's default user template and for all existing users.
# Code adapted from DeployStudio's rc130 ds_finalize script, from the section where DeployStudio is disabling the iCloud and gestures demos
osversionlong=`sw_vers -productVersion`
osvers=${osversionlong:3:1}
# Get the system's UUID to set ByHost prefs
MAC_UUID=$(system_profiler SPHardwareDataType | awk -F" " '/UUID/{print $3}')
# Checks first to see if the Mac is running 10.7 or 10.8. If so, the script
# checks the system default user template for the presence of
# the Library/Preferences and Library/Preferences/ByHost directories.
# If the directories are not found, they are created and then the
# "Enable applet plug-in and Web Start Applications" setting for Java
# setting is enabled.
if [[ ${osvers} -eq 7 || 8 ]];
then
for USER_TEMPLATE in "/System/Library/User Template"/*
do
if [ ! -d "${USER_TEMPLATE}"/Library/Preferences ]
then
mkdir -p "${USER_TEMPLATE}"/Library/Preferences
fi
if [ ! -d "${USER_TEMPLATE}"/Library/Preferences/ByHost ]
then
mkdir -p "${USER_TEMPLATE}"/Library/Preferences/ByHost
fi
if [ -d "${USER_TEMPLATE}"/Library/Preferences/ByHost ]
then
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real '356031204.300292'" "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
fi
done
fi
# Checks first to see if the Mac is running 10.7 or 10.8. If so, the script
# checks the existing user folders in /Users for the presence of
# the Library/Preferences and Library/Preferences/ByHost directories.
# If the directories are not found, they are created and then the
# "Enable applet plug-in and Web Start Applications" setting for Java
# setting is enabled.
if [[ ${osvers} -eq 7 || 8 ]];
then
for USER_HOME in /Users/*
do
USER_UID=`basename "${USER_HOME}"`
if [ ! "${USER_UID}" = "Shared" ]
then
if [ ! -d "${USER_HOME}"/Library/Preferences ]
then
mkdir -p "${USER_HOME}"/Library/Preferences
chown "${USER_UID}" "${USER_HOME}"/Library
chown "${USER_UID}" "${USER_HOME}"/Library/Preferences
fi
if [ ! -d "${USER_HOME}"/Library/Preferences/ByHost ]
then
mkdir -p "${USER_HOME}"/Library/Preferences/ByHost
chown "${USER_UID}" "${USER_HOME}"/Library
chown "${USER_UID}" "${USER_HOME}"/Library/Preferences
chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/ByHost
fi
if [ -d "${USER_HOME}"/Library/Preferences/ByHost ]
then
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" "${USER_HOME}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" "${USER_HOME}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" "${USER_HOME}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
/usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real '356031204.300292'" "${USER_HOME}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.*
fi
fi
done
fi
Posted on 05-09-2012 02:41 AM
Hi,
Does this script takes care of enabling the JAVA after 35 days?
Because I can't understand ```
"Add :GeneralByTask:Any:WebComponentsLastUsed real '356031204.300292'
``` . in the script. We need JAVA applet and webstart should be enabled always. Does this real value helps on keeping it enabled?
Regards,
Karthikeyan M
Posted on 05-09-2012 03:13 AM
I've got an updated version of the script that addresses the date issue. Instead of ```
"Add :GeneralByTask:Any:WebComponentsLastUsed real '356031204.300292', it now uses
"Add :GeneralByTask:Any:WebComponentsLastUsed real $(( $(date "+%s") - 978307200 ))"
``` to set the real key value.
Script is available from https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/enable_java_web_plugins_at...
Posted on 05-09-2012 07:41 AM
@rtrouton - thanks for posting the updated link. Works great.
Posted on 06-14-2012 11:51 AM
Is there an easy way to scope this only to machines that have applied this new Java OS X update that just hit (version 9 I believe)?
Also does this work on the 10.6 version?
Posted on 06-14-2012 12:24 PM
@gshackney, my script does work on 10.6.8 Macs that have had Java for Mac OS X 10.6 Update 9 applied. I've got a post on it here: