Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

unexpected exception!!!!!

843830Aug 9 2005 — edited Aug 9 2005
hello guys

i am having this exception with my Java mail program. This is just a simple sample code that use smtp protocol and using that sending a normal text based mail.The program compiled fine but giving the following exception message whereas I have saved the java file by main class name also the main method I have written accordingly.

The exception message is as follows:

Exception in thread "main" java.lang.NoClassDefFoundError: SendsSMTP


my code goes here...


public class SendSMTP
{
public static void main(String args[])
{
try
{
Properties p=new Properties();
p.put("mail.transport.protocol","smtp");
p.put("mail.smtp.host","smtp.dhaka.net");
p.put("mail.smtp.port","25");

Session mailSession=Session.getInstance(p);
Message msg=new MimeMessage(mailSession);
msg.setFrom(new InternetAddress("max@dhaka.net"));
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse("max@dhaka.net"));
msg.setSentDate(new Date());
msg.setSubject("Hello Java Mail World!!!");
msg.setContent(msgText+msgText2, "text/plain");
msg.setText("Hello from my first mail sent from Java Mail");

Transport.send(msg);
}catch(Exception e){
System.out.println("OOoops! Something has gone wrong!");
System.out.println(e);
}
}
}

what's causing the problem? any idea?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 6 2005
Added on Aug 9 2005
3 comments
102 views