不能从HTML另一个目录加载Java小程序 [英] Can't load Java applet from another directory in HTML
本文介绍了不能从HTML另一个目录加载Java小程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试加载一个小程序:
<对象类型=应用程序/ x-java的小程序HEIGHT =300WIDTH =550>
< PARAM NAME =code值=推箱子/>
< /对象>
在html文件在同一目录加载预期的小程序。
但是,当小程序在其他目录下code将无法工作:
<对象类型=应用程序/ x-java的小程序HEIGHT =300WIDTH =550>
< PARAM NAME =code值=推箱子/推箱子/>
< /对象>
(推箱子是小程序所在的目录,推箱子是小程序=> Sokoban.class)
解决方案
- 使用
deployJava.js
来部署小程序(从 applet的信息链接。页)。 - 使用
codeBase的
属性指向了推箱子
目录。 - 因为
code
属性必须是完全合格的类名,它返回到刚才推箱子
When i try to load an applet with :
<object type="application/x-java-applet" height="300" width="550">
<param name="code" value="Sokoban" />
</object>
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>
(sokoban is the directory the applet is in, Sokoban is the applet => Sokoban.class)
解决方案
- 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屋!
查看全文