Disregard... as soon as I posted this, I found a script that appears to work.
I know this has been discussed several times, but I wanted to throw my 2 cents in... I wrote a script to install and update Java. This version only does the JRE, although I'm sure you could expand it to do the JDK also.
1#!/bin/sh23# Get the latest version of Java4javaver=`curl -s http://javadl-esd-secure.oracle.com/update/baseline.version | grep 1.8.0_`5minorver=`echo $javaver | grep -o '...$'`67# Get build number (counting down from 20), since I can't find anywhere that Oracle publishes this in an easily-findable place8b=209while [ $b -gt 1 ] ; do10 echo "Build number $b"11 filename="jre-8i$minorver-macosx-x64.dmg"1213 curl -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u$minorver-b$b/96a7b8442fe848ef90c96a2fad6ed6d1/jre-8u$minorver-macosx-x64.dmg > $filename1415 # Check the file size of the download16 minsize="500000"17 filesize=$(wc -c <"$filename")1819 # If the file is larger than 500kb, assume it's the real dmg20 if [ $filesize -ge $minsize ]; then21 echo "Build number: $b succeeded"22 break23 fi2425 b=`expr $b - 1`26done2728# Attach the DMG29hdiutil attach jre-8i$minorver-macosx-x64.dmg3031# Install32sudo installer -pkg /Volumes/Java 8 Update $minorver/Java 8 Update $minorver.app/Contents/Resources/JavaAppletPlugin.pkg -target /3334# Remove DMG35rm jre-8i$minorver-macosx-x64.dmg3637# Unmount DMG38diskutil umount /Volumes/Java 8 Update $minorver
I'm positive it can be dramatically improved, but even though there are dozens of threads about it, I couldn't find a script that worked for me. So far, it's worked on a couple of my test systems, both without Java installed at all, and with an older version (1.8.0_131). It successfully installed/upgraded both.


