Re-enable the Apple Java 6 plug-in for use with web browsers
Once the Java for OS X 2012-006 update has been installed, the Apple-provided Java applet plug-in from /Library/Internet Plug-Ins is removed, which means that web browsers will not be able to launch Java applets from inside the browser. The update also removes the Java Preferences application from /Applications/Utilities.
However, the rest of the Java 6 framework is still installed and it is possible to re-enable the Apple-provided Java plug-in and browser functionality. Apple has provided a KBase article showing how to do this process manually, which allowed me to build a script that automates the process of removing the Oracle Java 7 plug-in and replace it with the Apple-built Java 6 plug-in.
#!/bin/sh # Checks for backup directory for Java 7 plug-in # and creates it if needed. if [ -d "/Library/Internet Plug-Ins (Disabled)" ]; then echo "Backup Directory Found" else mkdir "/Library/Internet Plug-Ins (Disabled)" chown -R root:wheel "/Library/Internet Plug-Ins (Disabled)" fi # If a previous version of the Java 7 plug-in is already # in the backup directory, the previously backed up Java 7 # plug-in is removed. if [ -d "/Library/Internet Plug-Ins (Disabled)/JavaAppletPlugin.plugin" ]; then rm -rf "/Library/Internet Plug-Ins (Disabled)/JavaAppletPlugin.plugin" fi # Moves current Java 7 plug-in to the backup directory if [ -d "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" ]; then mv "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" "/Library/Internet Plug-Ins (Disabled)/JavaAppletPlugin.plugin" fi # Create symlink to the Apple Java 6 plug-in in # /Library/Internet Plug-Ins ln -sf /System/Library/Java/Support/Deploy.bundle/Contents/Resources/JavaPlugin2_NPAPI.plugin "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" # Re-enable Java SE 6 Web Start, which allows Java # applets to run in web browsers ln -sf /System/Library/Frameworks/JavaVM.framework/Commands/javaws /usr/bin/javaws exit 0
This script is available here on my GitHub repo.
Update – 11-4-2012: I’ve received some emails asking for assistance with running this script. To help make this process easier, I’ve built and posted a payload-free installer package to my GitHub repo. If you need it, download the installer package and run it to execute the script on your own Mac.
Thanks for sharing … I am SURE that some colleagues will come to me in next months asking me why “java is broken” on their biotech software webapp.
Then I will use your tip!
what is -d ?
-d “/Library/Internet Plug-Ins (Disabled)”
-bash: -d: command not found
Hugh,
“-d” is a flag for the “if” command. For more information on “if”, please see here:
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
I have been testing with using the enable Java Web Plugins Script you posted on Github and seems to be working for me but I need additional entries in script to also switch to 32 bit preferred on 1100 MacBooks for an upcoming ACT Survey that does not support Java in 64 bit mode. Any help would be greatly appreciated.
Rick,
Unfortunately, getting 32-bit Java working once the Java for OS X 2012-006 update has been installed is beyond the scope of my script. The best advice I can offer in this case is to not install Java for OS X 2012-006.
I am having some problems with this script as well as the package. When I run the script or the installer it says it finished but the Power School grade book app still will not launch and tells me I need to install the Java runtime, providing a link to Oracle. Any idea what’s stopping me?
Thanks!
Nick,
Check with Pearson, I believe they put out an update for PowerSchool that fixes this issue:
https://discussions.apple.com/thread/4458993
Unfortunately, we just did the PS update before I installed the Java update that requires this fix.
Also, I would like to add that this only seems to be happening on our new iMacs. My 2012 MacBook Pro has no trouble at all, running Java 6. I am fully up to date, as well.
How do I undo this script? In essence, I ran it before realizing java had never been installed and want to start over.
good tutorial.. thanks for sharing.. 🙂
To the original poster, THANK YOU! was pulling my hair to get Java 6 enabled in all of my browsers and this did the trick. 🙂
This was a life saver, thank you so much for sharing.
I can’t believe how easily this solved my problem with this. Thank you very much for your help.
Totally worked, thanks so much for sharing the script