• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javax/mail/Message error

 
Kalai Selvi
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So do you have a copy of mail.jar in the WEB-INF/lib directory of your web app?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic