Skip to main content
Question

Java update - Enable applet plug-in and Web start applications


Forum|alt.badge.img+17

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.

11 replies

Forum|alt.badge.img+18
  • Valued Contributor
  • 1007 replies
  • April 30, 2012

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.


Forum|alt.badge.img+17
  • Author
  • Honored Contributor
  • 1143 replies
  • April 30, 2012

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)?


Forum|alt.badge.img+15
  • Esteemed Contributor
  • 719 replies
  • April 30, 2012

I created a script that I run at every user logon. It's based on some code from someone else doing the same thing.

1#!/bin/sh
2
3# Only for Mac OS 10.7
4
5if [ `sw_vers -productVersion | awk -F. '{ print $2 }'` -eq 7 ]; then
6
7 # Set the UUID for the ByHost File Naming
8 MAC_UUID=`system_profiler SPHardwareDataType | grep "Hardware UUID" | awk '{print $3}'`
9 if [ `echo $MAC_UUID | cut -c 1-24` == "00000000-0000-1000-8000-" ]; then
10 MAC_UUID=`echo $MAC_UUID | cut -c 25-36`
11 fi
12
13 # Set the "Enable applet plug-in and Web Start Applications" setting in Java Prefs
14 echo "UUID for ByHost file naming set to $MAC_UUID"
15
16 /usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
17 /usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
18 /usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
19 /usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real $(( $(date "+%s") - 978307200 ))" /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
20
21 chown $3 /Users/$3/Library/Preferences/ByHost/com.apple.java.JavaPreferences.$MAC_UUID.plist
22 echo "Java web plug-in enabled"
23fi

bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • 4331 replies
  • April 30, 2012

Maybe try the Oracle java update http://www.oracle.com/us/corporate/press/1603497?


Forum|alt.badge.img+17
  • Author
  • Honored Contributor
  • 1143 replies
  • April 30, 2012

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.


jhbush
Forum|alt.badge.img+26
  • Esteemed Contributor
  • 539 replies
  • May 1, 2012

I use Rich's script as a login script or along with the JAVA update to enable the plugin after the update.

1#!/bin/sh
2
3# 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.
4# Code adapted from DeployStudio's rc130 ds_finalize script, from the section where DeployStudio is disabling the iCloud and gestures demos
5
6osversionlong=`sw_vers -productVersion`
7osvers=${osversionlong:3:1}
8
9
10# Get the system's UUID to set ByHost prefs
11MAC_UUID=$(system_profiler SPHardwareDataType | awk -F" " '/UUID/{print $3}')
12
13# Checks first to see if the Mac is running 10.7 or 10.8. If so, the script
14# checks the system default user template for the presence of
15# the Library/Preferences and Library/Preferences/ByHost directories.
16# If the directories are not found, they are created and then the
17# "Enable applet plug-in and Web Start Applications" setting for Java
18# setting is enabled.
19
20if [[ ${osvers} -eq 7 || 8 ]];
21then
22 for USER_TEMPLATE in "/System/Library/User Template"/*
23 do
24 if [ ! -d "${USER_TEMPLATE}"/Library/Preferences ]
25 then
26 mkdir -p "${USER_TEMPLATE}"/Library/Preferences
27 fi
28 if [ ! -d "${USER_TEMPLATE}"/Library/Preferences/ByHost ]
29 then
30 mkdir -p "${USER_TEMPLATE}"/Library/Preferences/ByHost
31 fi
32 if [ -d "${USER_TEMPLATE}"/Library/Preferences/ByHost ]
33 then
34 /usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
35 /usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
36 /usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
37 /usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real '356031204.300292'" "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
38 fi
39 done
40fi
41
42
43# Checks first to see if the Mac is running 10.7 or 10.8. If so, the script
44# checks the existing user folders in /Users for the presence of
45# the Library/Preferences and Library/Preferences/ByHost directories.
46# If the directories are not found, they are created and then the
47# "Enable applet plug-in and Web Start Applications" setting for Java
48# setting is enabled.
49
50if [[ ${osvers} -eq 7 || 8 ]];
51then
52 for USER_HOME in /Users/*
53 do
54 USER_UID=`basename "${USER_HOME}"`
55 if [ ! "${USER_UID}" = "Shared" ]
56 then
57 if [ ! -d "${USER_HOME}"/Library/Preferences ]
58 then
59 mkdir -p "${USER_HOME}"/Library/Preferences
60 chown "${USER_UID}" "${USER_HOME}"/Library
61 chown "${USER_UID}" "${USER_HOME}"/Library/Preferences
62 fi
63 if [ ! -d "${USER_HOME}"/Library/Preferences/ByHost ]
64 then
65 mkdir -p "${USER_HOME}"/Library/Preferences/ByHost
66 chown "${USER_UID}" "${USER_HOME}"/Library
67 chown "${USER_UID}" "${USER_HOME}"/Library/Preferences
68 chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/ByHost
69 fi
70 if [ -d "${USER_HOME}"/Library/Preferences/ByHost ]
71 then
72 /usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsEnabled" "${USER_HOME}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
73 /usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" "${USER_HOME}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
74 /usr/libexec/PlistBuddy -c "Delete :GeneralByTask:Any:WebComponentsLastUsed" "${USER_HOME}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
75 /usr/libexec/PlistBuddy -c "Add :GeneralByTask:Any:WebComponentsLastUsed real '356031204.300292'" "${USER_HOME}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.plist
76 chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/ByHost/com.apple.java.JavaPreferences.${MAC_UUID}.*
77 fi
78 fi
79 done
80fi

karthikeyan_mac
Forum|alt.badge.img+18

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


Forum|alt.badge.img+31
  • Hall of Fame
  • 920 replies
  • May 9, 2012

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_login


Forum|alt.badge.img+17
  • Author
  • Honored Contributor
  • 1143 replies
  • May 9, 2012

@rtrouton - thanks for posting the updated link. Works great.


Forum|alt.badge.img+18
  • Esteemed Contributor
  • 831 replies
  • June 14, 2012

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?


Forum|alt.badge.img+31
  • Hall of Fame
  • 920 replies
  • June 14, 2012

@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:

http://derflounder.wordpress.com/2012/06/14/automatically-activate-the-java-web-plug-ins-setting-on-mac-os-x-10-6-x/


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings