aspose 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
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: 42608
    
  65
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: 42608
    
  65
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.
 
subject: javax/mail/Message error