想要通过小程序定期发送客户端的屏幕图像。爪哇
我正在使用嵌入在我的网页中的小程序。我正在使用 Robot 类将客户端的屏幕作为图像获取,并使用套接字发送 BufferedImage 。问题是我一这样做就得到PrivilegedAccessException
:-
Robot r = new Robot();
我不想强迫我的用户更改我的应用程序的java策略。我有哪些替代方案来捕获客户的屏幕?
其次,如果我直接从 Netbeans 6.8(而不是从网页)运行我的应用程序,当我编写 BufferedImage 的对象时,我会收到错误消息:BufferedImage 不是可序列化的 到套接字。如何摆脱这个问题?
提前致谢 :)
I am using applet that is embedded in my web page. I am using Robot class to get client's screen as a image and send the BufferedImage
using sockets. Problem is i am getting PrivilegedAccessException
as soon as i do :-
Robot r = new Robot();
I don't want to force my user to change their java policies for my application. What alternatives do i have to capture client's screen?
Secondly, if i run my application directly from Netbeans 6.8 (not from web page), i get error that BufferedImage
is not Serializable
when i write an object of BufferedImage
to socket. How to get rid of this problem?
Thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用您的小程序以及客户端计算机上所需的权限创建一个签名的 jar。您可以在此处了解更多信息。然后,小程序将在允许运行之前询问用户是否信任该小程序。
对于可序列化位,您必须将 BufferedImage 转换为可序列化文件。如果你必须这样做,你也可以使用 PNG 来压缩它。这将大大加快传输速度,通常是一个数量级。以下是有关此内容的更多信息。
You'll need to create a signed jar with your applet and the permissions you need on the client machine. You can read more here. The applet will then ask the user if he/she trusts the applet before allowing it to be run.
For the serializable bit, you'll have to convert the BufferedImage to a serializable file. If you have to do that you can just as well compress it using PNG. This will speedup the transfer a lot, usually an order of magnitude.Here is more info about that.