• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NoClassDefFoundError

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a method that sends an email to a recipient, which works well, without it being embedded into an applet, but as soon as I do put it in an applet I get the following error: java.lang.NoClassDefFoundError: javax/mail/MessagingException. Any ideas?

This is my applet code:



This is my class that has the method:



Any help would be very appreciated. I have searched on the net, and have had no luck in finding a solutions.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could it be that the JavaMail jar file is in regular classpath, but that you have not made it accessible to the applet? Applets do not use the classpath a normal application would; you will need to put the jar file into the web directory, togther with the applet files, and reference it in your web page.
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
you will need to put the jar file into the web directory, togther with the applet files, and reference it in your web page.





I'm losing my mind trying to get this to work... Is the web directory the /web-inf/lib?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by graham king:




I'm losing my mind trying to get this to work... Is the web directory the /web-inf/lib?



Definitely not! Just the document directory -- the same place as the other applet classes are.
 
graham king
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
the same place as the other applet classes are.



can they be put in an .ear?
ear
| | |
main.war main.jar ejb.jar
|
applet.jar main.jar

not sure what to do?
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at this page, specifically the part near the end about the "archive" attribute. It shows how to put multiple JAR files into an applet tag:

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One thing to note about applets is that they make use of the jre rather than the jdk, so make sure, if you have multiple java versions installed (jres and/or jdks) that you are using the same one being used when you're running the application.
This can be checked through the java control panel (can be accessed through control panel->Java plug-in)
Best,
Mohammad
 
graham king
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mohammad, Thanks for all your help!


You know I read your post about your imageio problem and unfortunately I have no help that I can provide, but, I was wondering if you could post an example of detecting the clients jre environment and how one could overwrite an older one with a newer one.

Thanks.

Graham
 
Mohammad Farhat
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Graham,
you can detect that by simply changing the html file containing your applet (which now i guess contains an applet tag) using a utility called htmlconverter.exe which comes inside the jdk\bin directory
using this utility would allow you to change the html file into one that would automatically check for the current installed version of jre on the client side, and then would install the version that you specified in the htmlconversion process if an older version is already there
and thanks for offering help..that's okay
Best,
Mohammad
 
I have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic