如何将小程序与 jar 中的包一起使用

发布于 2025-01-06 13:37:18 字数 616 浏览 2 评论 0原文

我有一个小程序(Applet,不是 JApplet),它有很多组织成包的类,包括小程序本身。我到处寻找如何使用那个罐子作为小程序。它不可运行,并且具有如下所示的清单文件:

Manifest-Version: 1.0
Class-Path: AppletSource.jar

我将其放入 html (Game.html) 中,如下所示:

<applet code="Game/Game.class" archive="Game.jar" width=800 height=600>
Your browser needs JAVA!!!
</applet>

正如您所看到的,该类名为 Game.class,Package Game 和 jar Game.jar。 清单位于 Game.jar/META-INF

当我使用 appletviewer Game.html 时,我收到错误(java.security.AccessControlException:访问被拒绝),如果我打开 .html,我会收到ClassNotFoundException:Game.Game.class。我能做些什么?

I have an applet (Applet, not JApplet) that has a lot of classes organized into packages, including the applet itself. I have looked everywhere for how to use that jar as an applet. It is not runnable and has a manifest file like such:

Manifest-Version: 1.0
Class-Path: AppletSource.jar

I put it in an html (Game.html), as such:

<applet code="Game/Game.class" archive="Game.jar" width=800 height=600>
Your browser needs JAVA!!!
</applet>

As you can see the class is called Game.class, Package Game and the jar Game.jar.
The manifest is in Game.jar/META-INF

When I use the appletviewer Game.html I get an error (java.security.AccessControlException: access denied) and if I open the .html I get a ClassNotFoundException: Game.Game.class. What can I do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ヤ经典坏疍 2025-01-13 13:37:18

尝试

<applet code="Game.Game" archive="Game.jar" width=800 height=600>
Your browser needs JAVA!!!
</applet>

同时检查包名称是否确实是Game,而不是game

try

<applet code="Game.Game" archive="Game.jar" width=800 height=600>
Your browser needs JAVA!!!
</applet>

Also check that the package name is really Game and not game.

梦醒时光 2025-01-13 13:37:18

applet 代码属性的格式来自 oracle 文档“The value appletFile can be of the form classname.class or of the form packagename.classname.class.”。
该文件与小程序的基本 URL 相关。不可能是绝对的。
还可以尝试将 jar 添加到与 html 相同的目录中。

有关更多信息,请参阅此文档
http://docs.oracle.com/javase/1.4 .2/docs/guide/misc/applet.html

The format for the applet code attribute is from oracle doc "The value appletFile can be of the form classname.class or of the form packagename.classname.class.".
This file is relative to the base URL of the applet. It cannot be absolute.
Also try adding the jar in the same directory as the html.

For some further information see this doc
http://docs.oracle.com/javase/1.4.2/docs/guide/misc/applet.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文