• 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

javax/mail/Message error

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written a program using javamail to send email.
When i run it as a standalone program, it works and sends email.

But, when i instantiate this class in my java program and call its method to send email,
it gives me

java.lang.NoClassDefFoundError: javax/mail/Message

I have mail.jar and activation.jar in the classpath.
My doubt is, why is it executing as a stand-alone program only?
Please help.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the difference between "run it as a standalone program" and "instantiate this class in my java program"? Both sound like a program is run from the command line, so the difference may be in how they are run (i.e., what is entered on the command line).
 
Kalai Selvi
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry.. When i include it in web application(running on tomcat5), it gives out

java.lang.NoClassDefFoundError: javax/mail/Message

at runtime.

I meant it as standalone, when i gave a main method for the SendEmail.java and run it.

But, within tomcat it always says java.lang.NoClassDefFoundError: javax/mail/Message

I've checked my whole system. i have only one mail.jar
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So do you have a copy of mail.jar in the WEB-INF/lib directory of your web app?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic