Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems with javamail  RSS feed

 
antonio rodriguez ayuso
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to all.

I have developed one application than send mails. When I compile, I don�t have problems, when I run, I have this exceptions:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Address

The soucer code is:

public static void smtpMail()
{
String Server="smtp.server.com";
String User="yo";
String Password="mipass";
String from="yo@server.com";
String to="tu@server.com";
String Subject="Email de prueba";

try {
//Configuramos session
Properties props = new Properties();
Session session = Session.getInstance(props, null);

//Configuramos message
MimeMessage message = new MimeMessage(session);
message.setSubject(Subject);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setText("Esto es un email de prueba para ver si funciona javamail.");

//Enviamos el mail

Transport transport = session.getTransport("smtp");
transport.connect(Server,User,Password);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
}
catch(Exception e){ System.out.println(e); }

}

I think it is problems of the classpath. Mi classpath is:

.C:\;C:\j2sdk1.4.2_05\lib;

I am using J2SDK 1.4.2.05 that it doesn't have the files MAIL.JAR and ACTIVATION.JAR. I have download these files and I have copied them in:

C:\j2sdk1.4.2_05\jre\lib\ext

I hope somebody can help me.

Thank to all in advance.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This belongs in our Other Java API's Forum, so I'm moving it there
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!