Skip to content

Instantly share code, notes, and snippets.

@sam
Created May 23, 2012 22:38
Show Gist options
  • Save sam/2778268 to your computer and use it in GitHub Desktop.
Save sam/2778268 to your computer and use it in GitHub Desktop.
Install OpenJDK7 on OSX
if ! [ -d /Library/Java/JavaVirtualMachines/1.7.0u6.jdk ]; then
echo "Downloading OpenJDK 7"
curl -o /tmp/OpenJDK-7.dmg http://openjdk-osx-build.googlecode.com/files/OpenJDK-OSX-1.7-universal-u-jdk-jdk7u6-b10-20120522.dmg
echo "Attaching DMG image"
hdiutil attach /tmp/OpenJDK-7.dmg
echo "Copying JDK into available Java Virtual Machines"
sudo cp -R /Volumes/OpenJDK\ 7\ \(Mac\ OS:X\ Port\)/1.7.0u.jdk /Library/Java/JavaVirtualMachines/1.7.0u6.jdk
echo "Detach DMG image"
hdiutil detach /Volumes/OpenJDK\ 7\ \(Mac\ OS:X\ Port\)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment