简体   繁体   English

在Mac上的JDK 7 AWT Applet中使复制/粘贴正常工作的任何解决方法?

[英]Any workaround to getting Copy/Paste working in JDK 7 AWT Applet on Mac?

Since Apple forced the update to JDK 7 on Mac, old AWT applets no longer support copy/paste. 由于Apple在Mac上强制更新到JDK 7,因此旧的AWT小程序不再支持复制/粘贴。 For example, if you visit: 例如,如果您访问:

Simple AWT Textfield Example 简单的AWT文本字段示例

you cannot copy and paste into the applet text field on that page. 您不能将其复制并粘贴到该页面上的applet文本字段中。 I've confirmed that you can still copy/paste in AWT on Windows with JDK 7. 我已经确认您仍然可以使用JDK 7在Windows的AWT中复制/粘贴。

Anybody know a workaround? 有人知道解决方法吗?

Oracle released Java 6 Update 24 in February 2011 to remedy 21 vulnerabilities: Announcement Oracle在2011年2月发布了Java 6 Update 24,以纠正21个漏洞:公告

As part of this security release, the ability to copy & paste from a computer's clipboard into a Java applet has been disabled. 作为此安全版本的一部分,已禁用了从计算机的剪贴板复制粘贴到Java小程序的功能。

To fix this issue there are 2 solutions: 要解决此问题,有2个解决方案:

  1. Create a digital signature for the applet. 为小程序创建数字签名。
  2. 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" 解决方法:如果您不想使用数字签名,请在您的java.policy文件中添加以下行:权限java.awt.AWTPermission“ accessClipboard”

Here is a great and very detailed walk-through to do it the official Java way using their policy tool: 这是使用其策略工具以官方Java方式完成此操作的非常详尽的演练:

http://www.shodor.org/interactivate/resources/InstructionsCopyPaste/ http://www.shodor.org/interactivate/resources/InstructionsCopyPaste/

Here is a quick summary of the instructions: 以下是说明的快速摘要:

  1. in Terminal.app type "policytool" and hit [Enter] 在Terminal.app中键入“ policytool”,然后按[Enter]
  2. dismiss any error message and choose "Save" from the "File" menu 关闭任何错误消息,然后从“文件”菜单中选择“保存”
  3. save as ".java.policy" (with a preceding dot) in your user's home directory 在用户的主目录中另存为“ .java.policy”(带有前导点)
  4. click "Add Policy Entry" and then "Add Permission" 单击“添加策略条目”,然后单击“添加权限”
  5. choose "AWTPermission" as the permission and "accessClipboard" as the target 选择“ AWTPermission”作为权限,选择“ accessClipboard”作为目标
  6. click "OK", then "Done" 点击“确定”,然后点击“完成”
  7. choose "Save" again, then "Exit" from the "File" menu 再次选择“保存”,然后从“文件”菜单中选择“退出”
  8. restart your browser (or your computer if copy/paste still doesn't work) 重新启动浏览器(如果复制/粘贴仍然无效,请重新启动计算机)

在他们修复该错误之前,我发现对小程序进行签名可以使复制/粘贴正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM