java.net.SocketPermission中的Applet [英] java.net.SocketPermission in Applet

查看:321
本文介绍了java.net.SocketPermission中的Applet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发,需要保存在服务器上的文本文件的小程序。这个问题冥思苦想了一阵后,我无意中发现Lynlin.class可以使用FTP连接发送文件在互联网上。工作正常提供我添加到C:\\ Program Files文件\\的Java \\ jre7 \\ lib \\ security中\\ java.policy文件一以下行:

I'm developing an applet that requires to save a text file on the server. After wrestling with this problem for a while I stumbled on the internet on the Lynlin.class which can send files using ftp connection. That works fine provided I add to my C:\Program Files\Java\jre7\lib\security\java.policy file a following line:

permission java.net.SocketPermission "192.168.33.15:*", "connect, accept ,resolve, listen";

如果我尝试从计算机此applet没有java.policy文件编辑我得到以下错误:

If I try to run this applet from the computer that did not have the java.policy file edited I get the following error:

java.security.AccessControlException: access denied 
    ("java.net.SocketPermission" "192.168.33.15:21" "connect,resolve")*

有谁知道我怎么能摆脱比将使用这个小程序的每一个计算机编辑java.policy文件等这个问题的?

Does anybody know how could I get rid of this problem other than editing java.policy file at each and every computer that will be using this applet?

只是为了claryfy:

Just to claryfy:


  • 我的小程序目前没有签名,但它试图发送一个文件服务器处于该小程序位于同一

  • my applet at the moment is not signed, but the server with which it tries to send a file is the same at which the applet is located

在HTTP和FTP服务器是Windows Server上运行微软的IIS 2003(IP 192.168.33.15)

the http and ftp server are microsoft IIS running on the Windows Server 2003 (ip 192.168.33.15)

推荐答案

至于EJP提到,该地址交付小程序,以及服务器的地址,似乎是运行applet的JRE不同。

As EJP alluded to, the address delivering the applet, and the address of the server, seem to be different to the JRE that is running the applet.

有必要通过服务器访问HTML(一个的http:// .. 地址)

It is necessary to access the HTML via the server (an http://.. address).

这篇关于java.net.SocketPermission中的Applet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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