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
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="";
String User="yo";
String Password="mipass";
String from="";
String to="";
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.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.sendMessage(message, message.getAllRecipients());
catch(Exception e){ System.out.println(e); }


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


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


I hope somebody can help me.

Thank to all in advance.
Joel McNary
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!