复制/粘贴在签名Applet无法正常工作 [英] Copy/Paste not working in a signed Applet

查看:686
本文介绍了复制/粘贴在签名Applet无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的签署的小程序(与正确验证的jarsigner ),由于某种原因不允许复制并从系统剪贴板粘贴成的JTextField 尽管文档告诉我,它应该用于签名applet工作。

I've a signed applet (which verifies correctly with jarsigner) that for some reason will not allow copy and paste from the system clipboard into a JTextField despite the documentation telling me that it is supposed to work for signed applets.

此外,我有它们具有相同的密钥文件那些让我复制和粘贴文本签名的小程序。我已搜查高和低在互联网上,似乎无法找到任何线索。是什么让我拉我的头发出的是,似乎没有办法调试这(在控制台没有输出 - 没有抛出的异常)。

Furthermore, I've other applets which are signed with the same keyfile that do let me copy and paste text. I have searched high and low on the internet and can't seem to find any clues. What is making me pull my hair out is that there seems to be no way to debug this (no output in the console - no thrown exceptions).

没有任何一个有我如何能调试这找出为什么Java不喜欢这个特别的小程序什么想法?

Does any one have any ideas on how I can debug this to find out why Java doesn't like this particular applet?

任何建议非常感谢!

推荐答案

哦,原来与Java插件1.6.0_24在2011年2月发布,复制以及从系统剪贴板粘贴被认为是一个安全漏洞和残疾人。您可以复制并粘贴在Applet之间。但是,如果你尝试使用的东西从你的主剪贴板,它不能在复制。

Well, it turns out with the release of the Java Plug-in 1.6.0_24 in February 2011, copy and paste from the system clipboard was deemed a security hole and disabled. You can copy and paste BETWEEN applets. But if you try to use something from your main clipboard, it can't be copied in.

因此​​,有一对夫妇的解决方法选项。您可以回滚到该插件的早期版本。这将工作,但机会是所有未来版本将仍然保持的复制和粘贴禁用,所以你从来没有能够升级。

So there are a couple of options for a workaround. You can roll back to an earlier version of the plug-in. That will work, but chances are all future releases will still keep copy and paste disabled, so you'd never be able to upgrade.

另一种方法是提供一个自定义的Java安全策略文件,其中又可以访问系统剪贴板。

The other alternative is to provide a custom java security policy file which enables access to the system clipboard again.

首先找到当地的Java安全策略文件。该文件名为java.policy中,应该在Java安装的lib \\ security文件夹。在Windows 7中,它可以位于C:\\ Program Files文件(x86)的\\的Java \\ JRE6 \\ lib \\ security中。
该文件(前C:\\用户\\凯尔)复制到您的主文件夹。
重命名文件的.java.policy(请注意在开始的时间)。
编辑在文本编辑器文件。找到这行文字:

First locate your local Java Security Policy file. The file is named java.policy and should be in the lib\security folder of your Java installation. On Windows 7, it can be found at C:\Program Files (x86)\Java\jre6\lib\security. Copy this file to your home folder (ex. C:\Users\Kyle). Rename the file to .java.policy (note the period at the beginning). Edit the file in a text editor. Locate this line of text:

// "standard" properies that can be read by anyone

添加以下行仅低于它像这样:

Add the following line just below it like so:

// "standard" properies that can be read by anyone
permission java.awt.AWTPermission "accessClipboard";

保存文件。
关闭所有打开的浏览器,并确保Java未能测试前运行。

Save the file. Close any open browsers and ensure that Java is not running before testing.

来源: http://blogs.oracle.com/kyle/entry/copy_and_paste_in_java

这篇关于复制/粘贴在签名Applet无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆