简体   繁体   English

Applet的.jar搞砸了吗?

[英]Applet's .jar is messing up?

I'm trying to put an applet into a Google site (Because Domain hosting costs money). 我正在尝试将applet放入Google网站(因为Domain托管需要花钱)。 I've got that working, it is in the site. 我有这个工作,它在网站上。 Now, I'm completely new to this, and my question is why doesn't my applet work? 现在,我对此完全陌生,我的问题是为什么我的applet不起作用?

The first thing I tried was uploading all the files to Google drive and accessing them there (My applet accesses multiple text files [ONLY READS, DOESN'T WRITE]) but that gave me a magic number error because FTP was ASCII which makes the class file all stupid, or so I've researched. 我尝试的第一件事是将所有文件上传到谷歌驱动器并在那里访问它们(我的applet访问多个文本文件[只读,不写])但这给了我一个神奇的数字错误,因为FTP是ASCII,这使得该类归档所有愚蠢,或者我研究过。

Okay, so I got a website that hosts files and it chooses the FTP (it automatically did Binary for my class files and ASCII for my text files) this made it better, but apparently unsigned applets can't access files other than the class file (I think). 好吧,所以我有一个托管文件的网站,它选择了FTP(它自动为我的类文件做了Binary,为我的文本文件做了ASCII)这使它变得更好,但显然未签名的applet无法访问除类文件以外的文件(我认为)。

So, I made a .jar for my applet using jar cvf [jar name].jar [blah blah blah, class files I need and text files I need] 所以,我使用jar cvf [jar name].jar [blah blah blah, class files I need and text files I need] .jar为我的applet创建了一个.jar jar cvf [jar name].jar [blah blah blah, class files I need and text files I need]

I uploaded it to my file hosting site, and alas - Magic number error! 我把它上传到我的文件托管网站,唉 - 魔术数字错误! 2 something something a lot of numbers. 2东西很多数字。 at this point, my HTML code looked like this: 此时,我的HTML代码如下所示:

<applet
codebase = "[URL for jar file]"
archive = "[jar file].jar"
code = "[class file].class"
width = ###
height = ###>
</applet>

paranoid that the site's FTP client was messing with my jar, I used FileZilla to upload to my server (an I selected the binary transfer type), which still resulted in a magic number error specifically 1347093252, which is the start of a zip file I believe (If it helps, when I click on the link for this file, it does in fact download). 网站的FTP客户端搞乱了我的jar,我使用FileZilla上传到我的服务器(我选择了二进制传输类型),这仍然导致了一个特殊的魔术数字错误1347093252,这是一个zip文件的开头我相信(如果有帮助,当我点击此文件的链接时,它实际上确实下载了)。

I've probably done something stupid, but I would like to reiterate that I'm completely new at this. 我可能做了一些愚蠢的事情,但我想重申一点,我对此完全陌生。

If anyone could help, that would be awesome; 如果有人可以提供帮助,那就太棒了;

Thing's I already tried: Clearing my java cache and loading the applet (from here on, assume all the thing listed end with "and loading the applet"), clearing it again, closing my browser, clearing my java cache, clearing my cache - closing my browser - clearing my cache, reloading, changing computers, changing internet connections, changing computers and internet connections. 我已经尝试过了:清除我的java缓存并加载applet(从这里开始,假设所有列出的内容以“并加载applet”结束),再次清除它,关闭浏览器,清除我的java缓存,清除缓存 - 关闭我的浏览器 - 清除缓存,重新加载,更换计算机,更改Internet连接,更改计算机和Internet连接。

First of all, an unsigned applet can read files off of the server it came from. 首先,未签名的applet可以从它来自的服务器上读取文件。 If you put dome text files in the same folder as your applet, the applet can grab then. 如果您将圆顶文本文件放在与applet相同的文件夹中,则applet可以抓取。 I think the method is something like getDocumentBase to get the directory your applet wad loaded from. 我认为该方法类似于getDocumentBase来获取你的applet加载的目录。 What you cannot do us access the local file system. 您无法访问本地文件系统。 Making jar files with the command line is a pain. 使用命令行制作jar文件很痛苦。 You might want to use an IDE like netbeans to build your project. 您可能希望使用像netbeans这样的IDE来构建项目。

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

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