0

I have an applet which is directly in my html page. It uses 4 other files. I am getting a NoClassDefFound error. My html file is in the same directory as my .class files, and looks like this:

<html>
<body>
<h1>Here is my Asteroids game!</h1>
<applet codebase = "." code = "Asteroids.class" name = "Asteroids" width = "640" height = "480" hspace = "0" vspace = "0" align = "middle">
</applet>
</body>
</html>

I'm using internet explorer, and my other applets work fine. Do I need to include the other files in my <applet> tag?

Full error:

Java Plug-in 10.6.2.24
Using JRE version 1.7.0_06-b24 Java HotSpot(TM) Client VM
User home directory = C:\Users\Stafford
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>

Stack trace:

asteroids:(wrong name asteroids/Asteroids)
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
imulsion
  • 8,820
  • 20
  • 54
  • 84

1 Answers1

2

A quick search of the error and I came across someone else with a similar issue and an answer. Try the suggestion over there: Java applet Error ... What is wrong?

I should mention that it is probably best to package your application into a jar file as it starts to grow in the number of class files. In that case, if javascript is acceptable, you may want to look into using one of the deployment libraries such as DeployJava.js or the newer dtjava.js for JavaFX applets. (still works for regular applets iirc)

You'll also need to go this route if you plan on utilizing any restricted features that require a signed applet. (such as file i/o)

Community
  • 1
  • 1