【问题标题】:Multi-class java applet to jar to html多类java小程序到jar到html
【发布时间】:2013-01-06 05:21:41
【问题描述】:

我已经把头撞在墙上几个小时了,试图找到一个关于如何将具有多个类文件的小程序编译为 html 文件的“好”教程。

我可能会以错误的方式解决这个问题。否则我弄错了该怎么做。

我有 3 个类:Particles(main) 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>

当我打开文件时,小程序说有错误,我的浏览器崩溃了

编辑/更新 错误是: "ClassNotFoundException" "Particles.class"

【问题讨论】:

  • 你发布那个错误怎么样?
  • 它什么也没说。它只是在小程序应出现在浏览器(所有浏览器)上的左上方显示“错误。单击以获取详细信息”。如果我点击浏览器将冻结,如果我不清楚,对不起
  • edit sorry 错误现在出现在 crome 中:/ 即讨厌我哈哈。错误是“ClassNotFoundException”“Particles.class”
  • 你有 Particles.class 和 index.html 在同一个文件夹吗?
  • 我也很好奇答案是什么。

标签: java html compilation applet


【解决方案1】:

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

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

希望有帮助:)

【讨论】:

    猜你喜欢
    • 2013-07-27
    • 2015-03-05
    • 1970-01-01
    • 2011-08-11
    • 1970-01-01
    • 2014-10-07
    • 2012-02-17
    • 2012-04-24
    • 1970-01-01
    相关资源
    最近更新 更多