Any workaround to getting Copy/Paste working in JDK 7 AWT Applet on Mac?
Solution 1
Oracle released Java 6 Update 24 in February 2011 to remedy 21 vulnerabilities: Announcement
As part of this security release, the ability to copy & paste from a computer's clipboard into a Java applet has been disabled.
To fix this issue there are 2 solutions:
- Create a digital signature for the applet.
- Work around: If you do not want to work with the digital signature, add to your java.policy file the following line: permission java.awt.AWTPermission "accessClipboard"
Solution 2
Here is a great and very detailed walk-through to do it the official Java way using their policy tool:
http://www.shodor.org/interactivate/resources/InstructionsCopyPaste/
Here is a quick summary of the instructions:
- in Terminal.app type "policytool" and hit [Enter]
- dismiss any error message and choose "Save" from the "File" menu
- save as ".java.policy" (with a preceding dot) in your user's home directory
- click "Add Policy Entry" and then "Add Permission"
- choose "AWTPermission" as the permission and "accessClipboard" as the target
- click "OK", then "Done"
- choose "Save" again, then "Exit" from the "File" menu
- restart your browser (or your computer if copy/paste still doesn't work)
Joshua Smith
Updated on June 04, 2022Comments
-
Joshua Smith almost 2 years
Since Apple forced the update to JDK 7 on Mac, old AWT applets no longer support copy/paste. For example, if you visit:
you cannot copy and paste into the applet text field on that page. I've confirmed that you can still copy/paste in AWT on Windows with JDK 7.
Anybody know a workaround?
-
Joshua Smith over 11 yearsThis is consistent with my findings. Can you provide a reference for this? I cannot find this documented in any of the release notes, and the Java teams at Oracle and Apple were not aware of this being "as designed" behavior. They encouraged me to file a bug report.
-
Guido over 11 yearsThis is th only reference I found so far:esecurityplanet.com/patches/article.php/3925146/…
-
Guido over 11 yearsA discussion about how the work-around solution worked for different people on different platforms can be seen here: sqlinform.com/forum4/read.php?3,467
-
Peter Mularien about 11 yearsWelcome to SO! Following the guidelines of "how to write a good answer" (meta.stackexchange.com/questions/7656/…), could you please try to summarize the instructions from the linked site so that future SO readers may benefit even if the site goes away?
-
Alexander Klar over 6 yearsThank you for your hint. I just saw it and have added a summary to my original post above.