Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Error: "NoClassDefFoundError"

 
Ranch Hand
Posts: 44
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone please explain to me why this html code will keep showing "NoClassDefFoundError" with a description "SimpleApp (wrong name: applet/simpleapp/SimpleApp)"?

It's a very simple code:



And here is the html code:

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<Applet code="SimpleApp" height="500" width="300" >
</applet>
</body>
</html>

I compiled the code with a specified destination since I like it that my source and class files are separated. I put the html code in the same folder as the SimpleApp.class folder.

Any help appreciated. Thanks!
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The class is in the package applet.simpleapp. You try to call it as SimpleApp, but because it is in the package applet.simpleapp the classes real name is applet.simpleapp.SimpleApp (not just SimpleApp, the 'real name' is called the fully specified name and is how you should refer to it from the HTML). In addition, the class SimpleApp must be in a directory structure that reflects the package it is in. So you should create a subfolder called applet, and subfolder of that called simpleapp, and put the SimpleApp.class file there:
 
Rod Taylor
Ranch Hand
Posts: 44
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply, Steve!

I get it now. So I should put the code="applet.simpleapp.SimpleApp" in the html code instead of just SimpleApp. And I also need to put the html code on the top directory along with applet directory, in which contains simpleapp directory, in which contains SimpleApp.class.

Thanks a lot! It works ok now!
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic