简体   繁体   中英

ClassNotFoundException Java Applet

I get the ClassNotFoundException error when I make my html file with the code and jar file. Not sure why. Here's what I have:

 <html>
<head>
<title>
Test Applet
</title>
</head>
<body>
<h2>Test Applet</h2>
<applet
code="Testing.class"
archive="myTestJar.jar" 
width=550 height=300>
</applet>
</body>
</html>

I simply have the class in a jar file and tried to reference using archive but it doesn't work.

try this

<applet code=Testing.class
        archive="myTestJar.jar"
        width=550 height=300>
</applet>

The class has your main() I assume, the jar is the entire thing.

if,you're not taking packages into consideration. For instance, if the package is myPackage.vol3 then the line should read

<applet code="myPackage.vol3.Testing.class" archive="myTestJar.jar"

and put the html file in the project folded "INSIDE" the project folder.

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