简体   繁体   中英

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. The .jar is called DocScrabble.jar, html is DocScrabble.html, and .class file is 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. DocScrabble.jar and DocScrabble.html are located in the same directory. The applet works fine in eclipse, so I am assuming that my html file is the problem. THere is the html code.

<!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. 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.

I typically rely on the W3C HTML validation service to check HTML.

Note that the applet element was last valid in HTML 3.2. It was deprecated in HTML 4.01. Without declaring any version, that mark-up would be presumed to be HTML 5.


The best way to deploy an applet is to use the Deployment Toolkit Script . 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.

For that reason it is a good idea to see the applet work when loaded using 'pure HTML' first.

Is your ScrabbleSolver class in a package? if so then it should be packagename.ScrabbleSolver.class

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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