With recent security issues involving the JRE, Apple has added a few layers of protection to prevent local Java Applets from running in a browser. In many cases you won’t see any warnings, errors, or further instructions; the applet will simply not appear in the web page. Of course, we’re seeing fewer and fewer new applets being made these days, but for those that are still supporting them, and want to do local testing on a Mac (OS X 10.7.3 Lion or greater), security restrictions will need to be lowered via the following steps:
WARNING: these security settings were enabled for a reason: to help avoid running malware on your system. If you decide to lower the security settings, you do so at your own risk. Personally, I lower the security to test my own code and then immediately reset the security levels back to a higher level when I’m finished.
- Make sure you are using the latest JRE available for the Mac. The latest version includes fixes for previous security issues. This isn’t just good advice… you may find that older versions of the Java plug-in won’t run anymore. Download the latest at: http://www.java.com/en/
- Java 7 requires a 64 bit browser, and Chrome, at the time I’m writing this entry, is 32 bits. So you’ll need to use another browser like Safari or Firefox. The following instructions are for Safari (version 6.0.4).
- Open up Safari’s Preferences and navigate to the “Advanced” panel.
- Check the “Show Develop menu in menu bar” checkbox:
- 5. You should see a new “Develop” menu bar item in Safari. Select that and “Disable Local File Restrictions.”
- Close Safari.
- Open the Mac System Preferences and select “Java” (found in the “Other” section).
- In the “Security” tab of the Java Control Panel, make sure the “Enable Java content in browser” checkbox is checked, and lower the security to “Medium.”
- Close the Java Control Panel and launch Safari.
- When you launch your local html file w/ applet, you’ll see a warning. As long as you recognize the applet it’s warning you about as being your own, click “run” (did I already say “At your own risk?” Yeah? OK then…)
Now your local applet should be displayed in your browser!