简体   繁体   English

html文件中找不到类异常Applet.jar

[英]Class not found exception Applet.jar in html file

I am trying to run an .jar file with a class in it that extends Applet in an html file. 我正在尝试运行具有其类的.jar文件,该类将Applet扩展为html文件。 The .jar is called DocScrabble.jar, html is DocScrabble.html, and .class file is ScrabbleSolver.class. .jar文件称为DocScrabble.jar,html文件名为DocScrabble.html,.class文件为ScrabbleSolver.class。 ScrabbleSolver.class also references a file called EnglishWords.txt, and I included that in the default package in which I placed ScrabbleSolver.class when I exported the file to a .jar. ScrabbleSolver.class还引用了一个名为EnglishWords.txt的文件,我将其包含在默认包中,当我将文件导出到.jar时,该默认包中放置了ScrabbleSolver.class。 DocScrabble.jar and DocScrabble.html are located in the same directory. DocScrabble.jar和DocScrabble.html位于同一目录中。 The applet works fine in eclipse, so I am assuming that my html file is the problem. 小程序在Eclipse中可以正常工作,所以我假设我的html文件是问题所在。 THere is the html code. 这是html代码。

<!DOCTYPE html>
<html>
<head>
<title>Doc Scrabble></title>
</head>
<body>
<APPLET CODE="ScrabbleSolver.class"
        ARCIHVE="DocScrabble.jar"
        WIDTH="400"
        HEIGHT="200"
</Applet>
</body>
</html> 

When i try to run the html, it gives me an error that says ClassNotFoundException ScrabbleSolver.class. 当我尝试运行html时,它给我一个错误,提示ClassNotFoundException ScrabbleSolver.class。 Could someone please tell me what's wrong? 有人可以告诉我怎么了吗? I'm relatively new to programming. 我是编程新手。

It is highly advisable to check HTML using a validation service or DTD. 强烈建议使用验证服务或DTD检查HTML。

I typically rely on the W3C HTML validation service to check HTML. 我通常依靠W3C HTML验证服务来检查HTML。

Note that the applet element was last valid in HTML 3.2. 请注意, applet元素在HTML 3.2中最后有效。 It was deprecated in HTML 4.01. HTML 4.01不推荐使用。 Without declaring any version, that mark-up would be presumed to be HTML 5. 如果不声明任何版本,该标记将假定为HTML 5。


The best way to deploy an applet is to use the Deployment Toolkit Script . 部署applet的最佳方法是使用Deployment Toolkit脚本 On the other hand mistakes in spelling the attribute names in the script would not be picked up by an HTML validation service, since it concentrates on the HTML, rather than JavaScript embedded in the HTML. 另一方面,HTML验证服务不会发现在脚本中拼写属性名称的错误,因为它集中在HTML而不是HTML中嵌入的JavaScript。

For that reason it is a good idea to see the applet work when loaded using 'pure HTML' first. 出于这个原因,它一个好主意,看看小程序工作中使用“纯HTML”第一次加载时。

Is your ScrabbleSolver class in a package? 您的ScrabbleSolver类在软件包中吗? if so then it should be packagename.ScrabbleSolver.class 如果是这样,则应为packagename.ScrabbleSolver.class

See Also: http://download.java.net/jdk8/docs/technotes/guides/jweb/applet/using_tags.html 另请参见: http : //download.java.net/jdk8/docs/technotes/guides/jweb/applet/using_tags.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM