I cannot get my applet to work because of package

well, as the title says, I am unable to get my applet ot show on a webpage because it is in a package, or atleast that is the only reason I can come up with.

I have bashed my head against this for days, trying hte find the way to do it, ub tI have been unsuccesful. so I though “maybe JGO will know the answer” so I am asking.

my jar is an attachment, and the main class is located at main\Main.class.

so how would you make the applet code for this?(imbedding in webpage).

thx in advance,
h3ckboy

I get this when I open the console :

java.lang.NoClassDefFoundError: main/states/MenuState

and when I opened your jar I couldn’t find that class. Are you sure the jar was correctly generated ?

maybe try <applet … codebase=“main” …/>

well, since it is an applet, there isnt supposed to be a main class… there is just a class that extends applet.

and I think it was generate correctly, because I used eclipse to do it.

I think he’s complaining about a class that was supposed to be in the jar, but it’s not . Dont u have a class named MenuState in your project ? if you have, it is not in the jar .

By the way, that’s the code of my applet : (and yes it starts loading but I get this error with the missing MenuState class )


<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 10] 10.2 Applets</TITLE>
</HEAD>
<body>
pompom
<center><applet code="main.Main.class" archive="tankdefence.jar" CODEBASE="." width=326 height=457></applet>
</center>
</body>
</html>

yeah, for some reason menustate isnt in the jar…

I will try re-jaring it.

EDIT:
I get this when I tried your code



java.lang.NullPointerException
	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Exception: java.lang.NullPointerException

thx in advance,
h3ckboy

EDIT2:
well turns out it is all eclipse’s fault, I didnt check with compiler warning, so a lot of my classes were missing.

I got it fixed now!

thx