i run this as a launch agent.
#!/usr/bin/perl -w
# config runtime environment
use strict;
use Getopt::Std;
use Sys::Syslog;
use Env qw(HOME);
my $MAC_UUID =system_profiler SPHardwareDataType | awk -F" " '/UUID/{print $3}'
;
chomp($MAC_UUID);
my $byhostdir = $HOME . "/Library/Preferences/ByHost/";
my $date = time - 978307200;
my $javapref = $byhostdir . "com.apple.java.JavaPreferences.$MAC_UUID.plist";
my $plistcmd = "/usr/libexec/PlistBuddy";
(my $progname =$0) =~ s#.*/##;
$ENV{PATH} = '/bin:/usr/bin:/usr/sbin';
umask 0022;
main:
openlog $progname, undef, 'user';
system("mkdir -p $byhostdir") unless (-d $byhostdir);
# Activates the "Enable applet plug-in and Web Start Applications" setting in Java Preferences
syslog('notice', "ensuring Java WebPlugin is enabled.");
system("$plistcmd -c "Add :GeneralByTask:Any:PrefsVersion string 2" $javapref");
system("$plistcmd -c "Add :GeneralByTask:Any:WebComponentsEnabled bool true" $javapref");
system("$plistcmd -c "Add :GeneralByTask:Any:WebComponentsLastUsed real $date" $javapref");
syslog('notice', "startup script complete");
closelog;
exit 0;