Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8945 > unrolled thread
| Started by | sahm <sahm007@gmail.com> |
|---|---|
| First post | 2011-10-18 03:12 -0700 |
| Last post | 2011-10-19 15:28 -0700 |
| Articles | 5 — 4 participants |
Back to article view | Back to comp.lang.java.programmer
I try to send e-mail for java but I get run time error sahm <sahm007@gmail.com> - 2011-10-18 03:12 -0700
Re: I try to send e-mail for java but I get run time error jlp <jlp@jlp.com> - 2011-10-18 16:19 +0200
Re: I try to send e-mail for java but I get run time error sahm <sahm007@gmail.com> - 2011-10-19 05:47 -0700
Re: I try to send e-mail for java but I get run time error Arne Vajhøj <arne@vajhoej.dk> - 2011-11-06 16:21 -0500
Re: I try to send e-mail for java but I get run time error Roedy Green <see_website@mindprod.com.invalid> - 2011-10-19 15:28 -0700
| From | sahm <sahm007@gmail.com> |
|---|---|
| Date | 2011-10-18 03:12 -0700 |
| Subject | I try to send e-mail for java but I get run time error |
| Message-ID | <e8f0b81a-c1ad-41ad-8447-0a44f339e33f@v15g2000vbm.googlegroups.com> |
Hi Every One
I tried to send e-mail for java code using Apache Commends Mail
library 1.2
and below is my code
====================Start===================
package netscan;
import org.apache.commons.mail.SimpleEmail;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.*;
/**
*
* @author salim
*/
public class SendMail {
public static void sendEmail()
{
System.out.println("Function is Colled");
try
{
SimpleEmail email = new SimpleEmail();
System.out.println("Email Opject is Created");
email.setHostName("mail.Hostname.com");
System.out.println("Host Name was Set");
//email.setAuthentication("my e-mail", "my Password");
email.setAuthenticator(new DefaultAuthenticator("my e-
mail","my password"));
email.setDebug(false);
//email.setDebug(true);
email.setSmtpPort(26);
email.addTo("receiver e-mail");
email.setFrom("my e-mail", "me");
email.setSubject("JAVA Test message");
email.setMsg("This is a simple test of commons-email");
email.send();
//return;
}
catch(EmailException ex)
{
System.out.println(ex.toString());
}
}
}
===================End====================
and there is no error in compaile time but in run time I get this
error
==========================================
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/
Message
at netscan.SendMail.sendEmail(SendMail.java:31)
at netscan.NetScan.main(NetScan.java:104)
Caused by: java.lang.ClassNotFoundException: javax.mail.Message
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 2 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
==========================================
I need your help
Best
Salim
[toc] | [next] | [standalone]
| From | jlp <jlp@jlp.com> |
|---|---|
| Date | 2011-10-18 16:19 +0200 |
| Message-ID | <4e9d8af9$0$30754$ba4acef3@reader.news.orange.fr> |
| In reply to | #8945 |
Le 18/10/2011 12:12, sahm a écrit :
> Hi Every One
>
> I tried to send e-mail for java code using Apache Commends Mail
> library 1.2
> and below is my code
> ====================Start===================
> package netscan;
>
> import org.apache.commons.mail.SimpleEmail;
> import org.apache.commons.mail.EmailException;
> import org.apache.commons.mail.*;
>
> /**
> *
> * @author salim
> */
> public class SendMail {
>
> public static void sendEmail()
> {
> System.out.println("Function is Colled");
> try
> {
>
>
> SimpleEmail email = new SimpleEmail();
> System.out.println("Email Opject is Created");
> email.setHostName("mail.Hostname.com");
> System.out.println("Host Name was Set");
> //email.setAuthentication("my e-mail", "my Password");
> email.setAuthenticator(new DefaultAuthenticator("my e-
> mail","my password"));
> email.setDebug(false);
> //email.setDebug(true);
> email.setSmtpPort(26);
>
> email.addTo("receiver e-mail");
>
> email.setFrom("my e-mail", "me");
> email.setSubject("JAVA Test message");
> email.setMsg("This is a simple test of commons-email");
> email.send();
>
> //return;
> }
> catch(EmailException ex)
> {
> System.out.println(ex.toString());
> }
> }
>
> }
> ===================End====================
>
> and there is no error in compaile time but in run time I get this
> error
>
> ==========================================
> Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/
> Message
> at netscan.SendMail.sendEmail(SendMail.java:31)
> at netscan.NetScan.main(NetScan.java:104)
> Caused by: java.lang.ClassNotFoundException: javax.mail.Message
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> ... 2 more
> Java Result: 1
> BUILD SUCCESSFUL (total time: 0 seconds)
> ==========================================
>
> I need your help
>
> Best
> Salim
the error is clear. It misses the import the javax.mail.* package (JEE
API)
[toc] | [prev] | [next] | [standalone]
| From | sahm <sahm007@gmail.com> |
|---|---|
| Date | 2011-10-19 05:47 -0700 |
| Message-ID | <1b4d9f5f-0832-4cd4-b185-615a5ca68e0d@hv4g2000vbb.googlegroups.com> |
| In reply to | #8948 |
On Oct 18, 5:19 pm, jlp <j...@jlp.com> wrote:
> Le 18/10/2011 12:12, sahm a écrit :
>
>
>
>
>
>
>
> > Hi Every One
>
> > I tried to send e-mail for java code using Apache Commends Mail
> > library 1.2
> > and below is my code
> > ====================Start===================
> > package netscan;
>
> > import org.apache.commons.mail.SimpleEmail;
> > import org.apache.commons.mail.EmailException;
> > import org.apache.commons.mail.*;
>
> > /**
> > *
> > * @author salim
> > */
> > public class SendMail {
>
> > public static void sendEmail()
> > {
> > System.out.println("Function is Colled");
> > try
> > {
>
> > SimpleEmail email = new SimpleEmail();
> > System.out.println("Email Opject is Created");
> > email.setHostName("mail.Hostname.com");
> > System.out.println("Host Name was Set");
> > //email.setAuthentication("my e-mail", "my Password");
> > email.setAuthenticator(new DefaultAuthenticator("my e-
> > mail","my password"));
> > email.setDebug(false);
> > //email.setDebug(true);
> > email.setSmtpPort(26);
>
> > email.addTo("receiver e-mail");
>
> > email.setFrom("my e-mail", "me");
> > email.setSubject("JAVA Test message");
> > email.setMsg("This is a simple test of commons-email");
> > email.send();
>
> > //return;
> > }
> > catch(EmailException ex)
> > {
> > System.out.println(ex.toString());
> > }
> > }
>
> > }
> > ===================End====================
>
> > and there is no error in compaile time but in run time I get this
> > error
>
> > ==========================================
> > Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/
> > Message
> > at netscan.SendMail.sendEmail(SendMail.java:31)
> > at netscan.NetScan.main(NetScan.java:104)
> > Caused by: java.lang.ClassNotFoundException: javax.mail.Message
> > at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> > ... 2 more
> > Java Result: 1
> > BUILD SUCCESSFUL (total time: 0 seconds)
> > ==========================================
>
> > I need your help
>
> > Best
> > Salim
>
> the error is clear. It misses the import the javax.mail.* package (JEE
> API)
Hi
Thank you It working now
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2011-11-06 16:21 -0500 |
| Message-ID | <4eb6fa51$0$290$14726298@news.sunsite.dk> |
| In reply to | #8948 |
On 10/18/2011 10:19 AM, jlp wrote: > Le 18/10/2011 12:12, sahm a écrit : >> Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/ >> Message >> at netscan.SendMail.sendEmail(SendMail.java:31) >> at netscan.NetScan.main(NetScan.java:104) >> Caused by: java.lang.ClassNotFoundException: javax.mail.Message >> at java.net.URLClassLoader$1.run(URLClassLoader.java:202) > the error is clear. It misses the import the javax.mail.* package (JEE API) It misses at least one class in javax.mail package that is used in the code. The import does not actually put any references in the class file it only allows shorter names to be used in the source code. Arne
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2011-10-19 15:28 -0700 |
| Message-ID | <lmju975dr0rmaul71jb4dflidbrhsh0rkb@4ax.com> |
| In reply to | #8945 |
On Tue, 18 Oct 2011 03:12:39 -0700 (PDT), sahm <sahm007@gmail.com> wrote, quoted or indirectly quoted someone who said : >Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/ It looks as though Apache is just a wrapper for JavaMail. You must install JavaMail by putting the jar in an ext directory. See http://mindprod.com/jgloss/javamail.html -- Roedy Green Canadian Mind Products http://mindprod.com It should not be considered an error when the user starts something already started or stops something already stopped. This applies to browsers, services, editors... It is inexcusable to punish the user by requiring some elaborate sequence to atone, e.g. open the task editor, find and kill some processes.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web