File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Sending an AutoGenerated Email Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sending an AutoGenerated Email" Watch "Sending an AutoGenerated Email" New topic
Author

Sending an AutoGenerated Email

divya narayan
Greenhorn

Joined: Sep 09, 2008
Posts: 3
I am trying to send an AutoGeneratedEmail from my javaapplication.
The jar files I use are mail.jar and activation.jar. But somehow both are not compatible and my code does not work.
My code is


And when I run without activation.jar it gives following error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSource
at com.vero.vas.email.EmailUtils.sendIfSaleEmail(EmailUtils.java:33)
at com.vero.vas.client.app.TestSendingEmail.main(TestSendingEmail.java:12)

Can someone tell me how to know the dependancy of mail.jar on activation.jar?

Thanks in advance

[edit]Add code tags. CR[/edit]
[ September 09, 2008: Message edited by: Campbell Ritchie ]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

Is your classpath set up correctly? Because that class is in activation.jar


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
divya narayan
Greenhorn

Joined: Sep 09, 2008
Posts: 3
Yes, my classpath is set correctly.
Since the program is getting compiled, classpath has to be set properly.

Does the versions of jar files make any difference?
If so please suggest me which versions i can use, my jdk is jdk1.5.0_11 and jre is jre1.5.0_11.

Thanks,
Divya
Karup Mew
Ranch Hand

Joined: Aug 11, 2007
Posts: 40
check the version of Javamail Api and JavaBeans Activation Framework(JAF)which contains mail.jar and activation.jar respectively and must include both jar files in classpath otherwise use JAVA SE6 because it already included the activation.jar
divya narayan
Greenhorn

Joined: Sep 09, 2008
Posts: 3
I have set classpath for both the jars.
The versions used are javamail-1_4_1.zip and jaf-1_1_1.zip respectively. Since my office uses this jdk version i cant update it to 6.

What else could be the reason?

Thanks,
Divya
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
Can we take a look at your classpath?

And also the path where the jars are contained?

Also how are you executing this program? As a stand alone Java Program or as part of some container based application?
[ September 11, 2008: Message edited by: Gamini Sirisena ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sending an AutoGenerated Email