简体   繁体   English

访问控制异常-访问被拒绝

[英]Access Control Exception - Access Denied

I'm new to this - I have never tried to put an applet online and I'm a fairly new programmer. 我是新来的-我从未尝试过将applet放在网上,而且我是一个相当新的程序员。

I tried to put an applet onto a webpage; 我试图将一个applet放到网页上。 the first applet I tried didn't work (Hosted class on a google site file File Cabinet, didn't work because the FTP was ASCII and for classes that results in a magic number error) 我尝试的第一个applet不起作用(Google网站文件“文件柜”上的托管类不起作用,因为FTP是ASCII的,并且导致了幻数错误的类)

So I found a place that can host my files and so that the FTP was BINARY (Which is required for an applet class to work). 因此,我找到了一个可以存放我的文件的位置,以便FTP是BINARY的(applet类必须工作)。 I made this change and the applet was fine, working fully in a browser, and I was happy. 我进行了更改,该applet很好,可以在浏览器中完全正常工作,我感到很高兴。

So now I'm trying to get an applet that accesses text files (hosted in the same place as the class file) to work, but no matter what I try it can't access them. 因此,现在我正在尝试使可以访问文本文件(与类文件位于同一位置)的applet正常工作,但是无论我如何尝试都无法访问它们。

From what I've read thus far, it seems like I have to create a signed applet so that I can access other files, but that means I have to make a jar file which I cannot do because this is an applet, no main method. 从到目前为止的内容看,似乎我必须创建一个签名的applet,以便可以访问其他文件,但这意味着我必须制作一个我无法执行的jar文件,因为这是applet,没有主要方法。

in short: I have an applet that tries to access other text files and it's not working (error in title) 简而言之:我有一个试图访问其他文本文件的小程序,但它不起作用(标题错误)

I may have made a mistake somewhere, and if so - any help would be appreciated. 我可能在某个地方犯了一个错误,如果是的话,我们将不胜感激。

From what I've read thus far, it seems like I have to create a signed applet so that I can access other files,... 从到目前为止的内容来看,似乎必须创建一个签名的小程序,以便可以访问其他文件,...

The problem is that a File created by applet code running on the client can never point to a location on the remote server. 问题在于,由客户端上运行的applet代码创建的File 永远无法指向远程服务器上的位置。 File objects just don't work that way. File对象只是不能那样工作。

This resource will need to be accessed by URL instead. 该资源将需要改为通过URL访问。 To form the URL, use a relative path from the code base or document base (where the HTML is). 要形成URL,请使用代码库或文档库(HTML所在的位置)的相对路径。 Note that an applet can 'phone home' to get resources from its own code base or document base—even when sand-boxed. 请注意,小程序可以“打电话回家”以从其自己的代码库或文档库中获取资源,即使是在沙盒中也是如此。

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

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