首页 文章

jar到html的多类java applet

提问于
浏览
1

我一直在墙上撞了几个小时,试图找到一个“好”的教程,教你如何将一个包含多个类文件的applet编译成一个html文件 .

我可能会以错误的方式解决这个问题 . 那或我错了怎么做 .

我有3个类:粒子(主)ParticleO和Handler

在cmd我输入命令:

jar cvfm Particle.jar manifest.txt *.*

表现:

Main-Class: Particles
(anextralinehere)

(我在src目录中)

它编译得很好(我想,我没有得到任何错误)

我做了一个index.html

<html>
<head>
<title> Particle </title>
</head>

<body>
<applet code='Particles.class' 
archive='Particle.jar',
 width="1200", height="600"/>
</applet>
</body>
</html>

当我打开文件并且applet说它有错误时,我的浏览器崩溃了

edit/update 错误是:"ClassNotFoundException" "Particles.class"

1 回答

  • 0

    您的“代码”属性不正确,您需要做的是code =“jarName.className” . 你不需要.class扩展名 .

    在您的情况下,您需要将您的代码属性更改为code =“Particle.Particle”

    希望有所帮助:)

相关问题