dcsimg
Functionality in JAR Question
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Phill_pc
Posted On:   Sunday, August 26, 2001 07:29 PM

Hi All, I have developed a JavaMail Application using JBuilder4Pro. It works fine when I run it without creating a JAR (including attachments). However if I package everything into a JAR JavaMail starts to work differently. I can still get all the message details but I can not see any attachments. Can anyone help with this ? The code for getting an attachment is shown bellow: // Get the attachments Multipart mp = (Multipart)oMailMessage.getContent(); int n = mp.getCount(); for(int j=0;j Part part = mp.getBodyPart(j); String disposition = part.getDisposition();    More>>

Hi All,


I have developed a JavaMail Application using JBuilder4Pro. It works fine when I run it without creating a JAR (including attachments).


However if I package everything into a JAR JavaMail starts to work differently. I can still get all the message details but I can not see any attachments.


Can anyone help with this ?
The code for getting an attachment is shown bellow:


// Get the attachments


Multipart mp = (Multipart)oMailMessage.getContent();


int n = mp.getCount();



for(int j=0;j


Part part = mp.getBodyPart(j);



String disposition = part.getDisposition();



if(disposition != null &&
(disposition.equals(Part.ATTACHMENT) ||
disposition.equals(Part.INLINE))) {


// Save the Attachment


saveAttachment(part.getFileName(), part.getInputStream());


}



The problem is with the line Multipart mp = (Multipart)oMailMessage.getContent();


It returns a SharedByteArrayInputStream instead of a MultiPart message when you
use it from a JAR file.


Again, this code works outside a JAR file.


Thanks,


** Phill **

   <<Less

Re: Functionality in JAR Question

Posted By:   fernando_fernandes  
Posted On:   Monday, September 3, 2001 03:05 PM

Is the jars from the javamail api (including the activation.jar) in the same directory of your jar?
About | Sitemap | Contact