Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java.lang.ClassNotFoundException

Status
Not open for further replies.

hottimbo

Programmer
May 10, 2002
6
0
0
GB
Hi,

I get a java.lang.ClassNotFoundException when I try and load my applet up in a browser.

I've created my package, I've jared it up to MyArchive.jar. It looks like this...

META-INF/
META-INF/MANIFEST.MF
classes/company/package/MyApplet.class
...

I put my jar file onto the webserver in the same dir as my html file, and check that the html code has the following line...

<APPLET CODE=&quot;MyApplet.class&quot; ARCHIVE=&quot;MyArchive.jar&quot; WIDTH=250 HEIGHT=250 NAME=&quot;My New Applet&quot;>


When I browse to this html file, I get the java.lang.ClassNotFoundException.

Anyone have any ideas what I'm doing wrong ?

Cheers,
Tim
 
Anytime you are referencing a class inside a jar in your applet tag you only want to supply it with the class name. The reason you need to do use the .class when you are not referencing a jar file is because the browser needs to be able to find the class file, if the class is inside the jar then it has already found the jar file. You may need to specify the class as CODE=&quot;classes/company/package/MyApplet&quot; in order for the client crowser to find it, I'm not sure (rusty).

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top