applet问题,求教

yangjinfeng 2004-08-19 07:24:35
我做了个applet,编译后有好几个类,请问如何在html文件里把它加载进来需要打包成jar文件吗?相应的的code archive参数如何赋值
...全文
72 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangjinfeng 2004-08-20
  • 打赏
  • 举报
回复
我的系统是windows2003 ,我把我的程序放到别人的windows2000上运行正常,且显示速度很快,为什么在2003上不行呢?
yangjinfeng 2004-08-20
  • 打赏
  • 举报
回复
谢谢dreamno(C_S_D_N),但我的问题还是没有解决

我的applet源文件是MouseAppletClick.java,编译后得到MouseAppletClick.class 和MouseAppletClick$1.class,我把这两个class文件用jar打包成my.jar,
在html文件里
<html>
<body>
<APPLET CODE="MouseClickApplet.class" ARCHIVE="MY.JAR" WIDTH=300 HEIGHT=150>
</APPLET>
</body>
</html>

所有这些文件都在同一个目录下,但在浏览器里还是没有显示,请问这是到底为什么?
dlxu 2004-08-19
  • 打赏
  • 举报
回复
注意你使用的JDK的版本,要是太高可能普通IE浏览器无法显示
dreamno 2004-08-19
  • 打赏
  • 举报
回复
这个是必须将html和class.jar放在一格目录下。
如果放在服务器上
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<title>
HTML Test Page
</title>
</head>
<body>
Applet1 will appear below in a Java enabled browser.<br>
<applet
codebase = "http://Ed/7/"
code = "AppletZip.class"
archive = "class.jar"
name = "TestApplet"
width = "400"
height = "300"
hspace = "0"
vspace = "0"
align = "middle"
>
</applet>
</body>
</html>
表示这个class.jar在服务器下的7/下
dreamno 2004-08-19
  • 打赏
  • 举报
回复
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<title>
HTML Test Page
</title>
</head>
<body>
Applet1 will appear below in a Java enabled browser.<br>
<applet
codebase = "."
code = "AppletZip.class"
archive = "class.jar"
name = "TestApplet"
width = "400"
height = "300"
hspace = "0"
vspace = "0"
align = "middle"
>
</applet>
</body>
</html>

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧