多类 Java Applet
我的代码使用 Eclipse,我的包名称是 com.neelsomani.rocketman。
我不知道如何正确上传我的 Java 小程序。到目前为止,我在同一个 .java 中有两个类。我编译代码,然后查看 bin/com/neelsomani/rocketman
。那里有四个 .class
文件。有 RocketMan$1.class
、RocketMan.class
、RocketMan$2.class
和 RocketMan$Meteor.class
。
我尝试将所有这些内容上传到我的网站,但没有成功。我使用 RocketMan.class
作为小程序标签的 code 属性。以下是该页面的链接: http://www.theawesomenesssite.com/applet/rocketman.php 。
您可以在此处查看我上传文件的方式:http://www.theawesomenesssite.com/applet/。
我将 images
文件夹保存在 Mac 上的 bin
文件夹中,并且运行良好。我应该将文件夹放在网站上的某个位置吗?
谢谢。
尼尔
I'm using Eclipse for my code, and my package name is com.neelsomani.rocketman.
I'm not sure how to properly upload my Java applet. So far I have two classes in the same .java. I compile my code, then look in bin/com/neelsomani/rocketman
. There are four .class
files there. There is RocketMan$1.class
, RocketMan.class
, RocketMan$2.class
, and RocketMan$Meteor.class
.
I tried uploading all of these to my website but it didn't work. I used RocketMan.class
for the code attribute of the applet tag. Here is the link to the page: http://www.theawesomenesssite.com/applet/rocketman.php.
You can view the way I uploaded the files here: http://www.theawesomenesssite.com/applet/.
I keep my images
folder in the bin
folder on my Mac and it runs fine. Is there some place that I should be putting the folder on my site?
Thanks.
Neel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您指定的类名不正确。需要是完全限定的名称,即。包括包名和类名。它需要类名,而不是类文件名。
您还需要将类文件(您需要所有这些文件)上传到与包路径相同的目录结构中。所以在你的情况下你的课程应该在
you've specified the classname incorrectly. Needs to be the fully qualified name ie. include the package and class name. It expects the class name, not the class filename
You also need to upload the class files (you need all of them) in the same directory structure as the package path. So in your case your classes should be in
如果您不想单独上传
.class
文件(并且浏览器/插件单独下载它们),您也可以将它们放入 jar 文件中,位于包结构给定的目录结构中,像这样:对于图像,您可以将它们放在同一个 jar 文件中 - 但请确保使用 Class.getRessource() 或将它们加载到小程序中相关功能,而不是作为文件。
然后使用
If you don't want to upload the
.class
files individually (and the browser/plugin download them individually), you could also put them in a jar file, in the directory structure given by the package structure, like this:For the images, you can put them in the same jar file - but make sure you load them in the applet with Class.getRessource() or related functions, not as a file.
Then use the
archive
attribute for your<applet>
tag.