when sending the mail from java I am getting the below error
when sending the mail from java I am getting the below error
:
Exception in thread "main" java.lang.NoClassDefFoundError: javax.mail.internet.MimeMessage
at java.lang.Class.initializeClass(libgcj.so.7rh)
at SendMail.main(SendMail.java:23)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataSource not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/mail/mail.jar,file:/mail/], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
Code:
SendMail.java
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class SendMail {
public static void main(String args[]) throws Exception {
System.out.println("Message Send.1....");
String host = "xxxxxxxxxxxx";
String from = "
[email protected]";
String to = "
[email protected]";
System.out.println("Message Send.2....");
// Get system properties
Properties properties = System.getProperties();
System.out.println("Message Send..3...");
// Setup mail server
properties.setProperty("mail.smtp.host", host);
// Get the default Session object.
Session session = Session.getDefaultInstance(properties);
System.out.println("Message Send..4...");
// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);
// Set the RFC 822 "From" header field using the
// value of the InternetAddress.getLocalAddress method.
message.setFrom(new InternetAddress(from));
// Add the given addresses to the specified recipient type.
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
// Set the "Subject" header field.
message.setSubject("hi..!");
// Sets the given String as this part's content,
// with a MIME type of "text/plain".
message.setText("Hi ......");
// Send message
Transport.send(message);
System.out.println("Message Sent.....");
}
}
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.Class.initializeClass(libgcj.so.7rh)
View Answers
July 2, 2010 at 2:53 PM
Hi Friend,
It seems that you haven't set the classpath to include the mail.jar file. Check it.
For more information, visit the following link:
http://www.roseindia.net/javamail/Thanks
Related Tutorials/Questions & Answers:
Advertisements
i am getting an error in adding a menu item to a menu. i am getting an
error in adding a menu item to a menu.
i am not able to execute the menu program.
i am getting an
error at menu.add(menuitem); it says add method is undefined for type menu. but as far as
i know that is only way
getting an error when set classpathgetting an
error when set classpath Hello Everyone!
i have used hssf model for reading excel sheet in my project &
i have set classpath for that jar file but
when i compile the program it will compile correctly but
when i I am getting this exception I am getting this exception Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java
Page is not getting loaded when I refresh the webpage???Page is not
getting loaded
when I refresh the webpage??? **
I am... function in JSP.
It will get all details of image section
from database.
*
I am...
when I refresh the page.*
Note: Header section is
getting loaded always
Could
java mail sending with imagesjava mail sending with images
I need to send images through
java mail without giving content path(i.e. we don't want hard code the image path)can you tell me the idea?
Please visit the following links:
http
Sending images through java mailSending images through
java mail
Am trying to develop greeting application that having images..... in one jsp page
i displayed all images and by clicking one image the control go to
mail sending page in that the image should add
i am getting multiple values in listbox i am getting multiple values in listbox hi sir,
i am using... table group by stuname) order by a.name
in a subquery multiple recdates
i am getting its working fine, but in main query also
i am getting multiple name
sending a mail - JSP-Servletsending a mail
I m writing a code for send
mail in jsp,
i sending a
mail to specified receiver but if
i attach an file and send a
mail then
i m
getting an
error.
Here Attachment is in String[] Attachment=null so how
Jsp error when i run this a jsp fileJsp
error when i run this a jsp file hi
I got this
error when i run the jsp file in IDE and outside also
please help me
java.lang.NullPointerException
org.apache.jsp.insertjsp.jspInit(insert_jsp.java:22
Sending SMS From Java ProgramsSending SMS
From Java Programs
I want to develop and application to send sms
from my computer, can someone please help me, like tell me where to start and what
i need
I am getting error.How can i get detailsI am getting error.How can
i get details Exception in thread "main" java.sql.SQLException: Listener refused the connecti
n with the following
error:
ORA-12505, TNS:listener does not currently know of SID given in connect
iphone mail sending problemiphone
mail sending problem Hi, I'm receiving the following
error ... while
sending mail in my iphone application
Terminating app due to uncaught...
getting this
error and to solve it?
Thanks in Advance!
Hi all,
I get
i am unable to identify the error in my codei am unable to identify the
error in my code class Program
{
public static void main(String[] args)
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter
i am unable to identify the error in my codei am unable to identify the
error in my code class Program
{
public static void main(String[] args)
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter
How to load elements from db when i press next.How to load elements
from db
when i press next. Hello ,
I am working on a project "Online Book Mart" using JSP and Servlets and
I am astuck... means
when i click next, the next 20 books will be displayed
from db on the same
No module named 'absl' error when I import tensorflowNo module named 'absl'
error when I import tensorflow Hi,
In one... the errror:
No module named 'absl'
error when I import tensorflow
Earlier... to resolve the
error:
No module named 'absl'
error when I import tensorflow
No module named 'absl' error when I import tensorflowNo module named 'absl'
error when I import tensorflow Hi,
In one... the errror:
No module named 'absl'
error when I import tensorflow
Earlier... to resolve the
error:
No module named 'absl'
error when I import tensorflow
No module named 'absl' error when I import tensorflowNo module named 'absl'
error when I import tensorflow Hi,
In one... the errror:
No module named 'absl'
error when I import tensorflow
Earlier... to resolve the
error:
No module named 'absl'
error when I import tensorflow
No module named 'absl' error when I import tensorflowNo module named 'absl'
error when I import tensorflow Hi,
In one... the errror:
No module named 'absl'
error when I import tensorflow
Earlier... to resolve the
error:
No module named 'absl'
error when I import tensorflow
No module named 'absl' error when I import tensorflowNo module named 'absl'
error when I import tensorflow Hi,
In one... the errror:
No module named 'absl'
error when I import tensorflow
Earlier... to resolve the
error:
No module named 'absl'
error when I import tensorflow
No module named 'absl' error when I import tensorflowNo module named 'absl'
error when I import tensorflow Hi,
In one... the errror:
No module named 'absl'
error when I import tensorflowADS_TO_REPLACE_1... Python.
How to resolve the
error:
No module named 'absl'
error when I Sending mail - JavaMailSending mail Need a simple example of
sending mail in Java ... java.lang.String subject = ""; public java.lang.Exception
error;public
Mail...() { return
error;}public java.lang.String getFrom() { return
from java mail error - JavaMailjava mail error how to rceive emails using
java mail api Hi Friend,
We can use
Java Mail APIs to send and receive mails in
Java.... Please visit the following link to know more about use of
Java Mail API.
http
sending mail - JSP-Servletsending mail Hi,
what is the code for
sending mail automatically without user intervention? thanks in advance
I am from .net background, I want to learn SOA.I am from .net background,
I want to learn SOA. Hi
I am from .net background,
I want to learn SOA.
Could it possible for me to learn SOA,
I suppose SOA includes
Java.
I dont have knowledge of
java.
Please help
Thanks
compiled but showing below errorcompiled but showing
below error Good morning,
By using axis api,
am getting the following
error but the wsdl file is generating.
what is the mistake
I done.
Unable to find required classes (javax.activation.DataHandler
page is not getting loaded when refreshing???page is not
getting loaded
when refreshing???
I am loading an image.... It will get all details of image section
from database.
I am getting header section always but page is not
getting loaded after the header section
when I Getting an error :(Getting an
error :(
I implemented the same code as above..
But
getting this
error in console...
Console
Oct 5, 2012 10:18:14
AM...:SpringMVC' did not find a matching property.
Oct 5, 2012 10:18:14
AM Sending mail (Contact Form in a website)Sending mail (Contact Form in a website) Hi,
I just uploaded few of my webpages into a free web hosting service, where
i can just upload the web pages.
Am very much new into this field.
I want to write a contact form, which
sending mail using jspsending mail using jsp please give me the detailed procedure and code for
sending mail through jsp program
Please visit the following links:
http://www.roseindia.net/ejb/introduction/j2eedemo.shtml
http