File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes javax/mail/Message error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "javax/mail/Message error" Watch "javax/mail/Message error" New topic
Author

javax/mail/Message error

Kalai Selvi
Ranch Hand

Joined: Jan 08, 2007
Posts: 45
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
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
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).


Ping & DNS - my free Android networking tools app
Kalai Selvi
Ranch Hand

Joined: Jan 08, 2007
Posts: 45
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
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
So do you have a copy of mail.jar in the WEB-INF/lib directory of your web app?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: javax/mail/Message error
 
Similar Threads
Javax Mail Transport.send(message) is blocking!
Cannot find class javax/mail/message
Unknown SMTP Host
java mail api
javamail