dcsimg
" java.lang.NoClassDefFoundError: javax/mail/Address" Error
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sheejo_rapheal
Posted On:   Thursday, July 22, 2004 08:53 PM

Hi I am Sheejo Rapheal. I have one doubt in Java Mail. Please help me. My code is ****************** import javax.mail.*; import javax.mail.internet.*; class MailExample { public static void main (String args[]) { System.out.println("1"); try{ String host = "dedicated.s2lmail.com"; String from = "clears@learningaccord.com"; String to = "sheejo@learningaccord.com"; System.out.println("2"); // Get system properties Properties props = System.getProperties(); System.out.println("3"); // Setup mail server props.put("mail.smtp.host", host); System.   More>>

Hi

I am Sheejo Rapheal. I have one doubt in Java Mail. Please help me.
My code is
******************
import javax.mail.*;
import javax.mail.internet.*;

class MailExample {
public static void main (String args[]) {
System.out.println("1");
try{
String host = "dedicated.s2lmail.com";
String from = "clears@learningaccord.com";
String to = "sheejo@learningaccord.com";
System.out.println("2"); // Get system properties
Properties props = System.getProperties();
System.out.println("3");
// Setup mail server
props.put("mail.smtp.host", host);
System.out.println("4");
// Get session
Session session = Session.getDefaultInstance(props, null);
System.out.println("5");
// Define message
MimeMessage message = new MimeMessage(session);

// Set the from address
message.setFrom(new InternetAddress(from));

// Set the to address
message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));

// Set the subject
message.setSubject("Hello JavaMail");

// Set the content
message.setText("Welcome to JavaMail");

// Send message
Transport.send(message);
}
catch (Exception e)
{
System.out.println("Error::"+e);
}
}
}
*************************************************
I can compile the code but I am getting "Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Address" run time Error. Please give me a solution

Have a nice time

With warm regards
Sheejo Rapheal

   <<Less
About | Sitemap | Contact