无法从 HTML 中的另一个目录加载 Java 小程序 [英] Can't load Java applet from another directory in HTML
本文介绍了无法从 HTML 中的另一个目录加载 Java 小程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试加载小程序时:
When i try to load an applet with :
<object type="application/x-java-applet" height="300" width="550">
<param name="code" value="Sokoban" />
</object>
当 html 文件与小程序位于同一目录时,它会按预期加载.
when the html file is in the same directory as the applet it loads as expected.
但是当小程序在另一个目录中时,以下代码将不起作用:
But when the applet is in an another directory the following code won't work :
<object type="application/x-java-applet" height="300" width="550">
<param name="code" value="sokoban/Sokoban" />
</object>
(推箱子是小程序所在的目录,推箱子是小程序=>推箱子.class)
(sokoban is the directory the applet is in, Sokoban is the applet => Sokoban.class)
推荐答案
- 使用
deployJava.js
部署小程序(链接自 小程序信息页面). - 使用
codebase
属性指向sokoban
目录. - 由于
code
属性需要是完全限定的类名,所以将其返回到Sokoban
- Use
deployJava.js
to deploy the applet (linked from the applet info. page). - Use the
codebase
attribute to point to thesokoban
directory. - Since the
code
attribute needs to be the fully qualified class name, return it to justSokoban
这篇关于无法从 HTML 中的另一个目录加载 Java 小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文