Java install and plugin enable

lehmanp00
Contributor III

I'm hoping to find a way to install the Java runtime on OS X 10.7-10.8 and enable the web plugin, all using non-GUI methods. I have a whole lab to do and and don't really want to have to sit on each computer to do this!

I have tried to use the .pkg from Oracle, but the plugin doesn't seem to work.

3 REPLIES 3

nessts
Valued Contributor II

what web plugin do you want the 1.7 or the 1.6?
you should be able to install both packages from Apple and from Oracle through your Casper server silently and if you want the 1.7 plugin you are done. if you want the 1.6 plugin you could run this script on the workstations through casper

#!/usr/bin/perl -w

# $Id: $
# $Log: $

# config runtime environment
use strict;
use Getopt::Std;
use Sys::Syslog;

(my $progname =$0) =~ s#.*/##;
$ENV{PATH} = '/bin:/usr/bin:/usr/sbin';
umask 0022;
use vars qw($opt_h);

my $basedir    = $ARGV[2] || '/';
my $plugindir  = $basedir . "/Library/Internet Plug-Ins/";
my $disabldir  = $plugindir . "disabled";
my $javaplugin = $basedir . "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin";
my $javaws     = $basedir . "/usr/bin/javaws";
my $launchd        = $basedir . "/Library/LaunchDaemons/com.hp.useAppleJavaWebPlugin";
my $launchplist= $launchd . ".plist";
my $linksrc1   = "/System/Library/Java/Support/Deploy.bundle/Contents/Resources/JavaPlugin2_NPAPI.plugin";
my $linksrc2   = "/System/Library/Frameworks/JavaVM.framework/Commands/javaws";

# Subroutines
sub usage {
   (my $usage = << "   USAGE") =~ s/^	//;
   usage: $progname -[h] Only on 10.7 or 10.8
   h: this help message
   no options enables the 1.6 java plugin
   USAGE
   die $usage;
}


main:
undef $opt_h;
my $rc = getopts('h');
& usage if(($opt_h);
openlog $progname, undef, 'user';
unless (-e $disabldir) {
        system("mkdir "$disabldir"");
        system("chmod 755 "$disabldir"");
        syslog('notice', "making disabled plugin directory");
}
if (-d $disabldir ) {
        syslog('notice', "moving current plugin to disabled directory");
        system("mv "$javaplugin" "$disabldir"");
}
else {
        syslog('notice', "removing current plugin disabled directory does not exist");
        system("rm -rf  "$javaplugin"");
}
if (-l $javaplugin) {
        syslog('notice', "removing existins java plugin");
        system("rm -rf "$javaplugin"");
}
syslog('notice', "linking 1.6 plugin");
symlink $linksrc1 ,$javaplugin;
if (-l $javaws) {
        syslog('notice', "removing existins javaws");
        system("rm -rf "$javaws"");
}
syslog('notice', "linking 1.6 javaws");
symlink $linksrc2 ,$javaws;
system("defaults write "$launchd" Disabled -bool yes");
chmod 0644, $launchplist;
closelog;

nessts
Valued Contributor II

oops there is an extra ( in & usage if(($opt_h);
sorry about that, removed some of my custom code and missed that.

lehmanp00
Contributor III

Thank you for you help. I totally forgot about the .pkg way.

A couple of things....

This particular website was written for Java 7. The Apple Java would not work.

I had to download the installer from Oracle and then push out the .pkg.