> I said :
>
> " Same error if I try : java -cp email.jar Main
>
> Where do I do wrong ? "
>
>
> So it is not the solution.
>
> Thanks
>
> I'm on GNU/Linux Debian (sid) with java 1.6
>
> ii sun-java6-jdk
> 6-14-1 Sun Java(TM) Development Kit (JDK) 6
>
>
>
> JORGE VILA FORCEN a écrit :
>> java -cp email.jar Main
>>
>> without .java
>> --
>> __________________________________________________________________
>>
>> Jorge Vila Forcén
>>
>> Networked Vehicles Division Mail:
jorgev@...
>> TELEFONICA I+D
>> Emilio Vargas, 6 28043 Madrid (SPAIN) Tel: +34 91 337 2614
>> __________________________________________________________________
>> ________________________________________
>> De: Alfred Sawaya [
alfred@...]
>> Enviado el: viernes, 19 de junio de 2009 13:39
>> Para:
user@...
>> Asunto: Error while executing code with SimpleEmail class
>>
>> Hello world !
>>
>> I'm trying to use the SimpleMail class but I don't manage to send
>> my mail.
>> I'm not experienced in Java, and I think it's about how I include the
>> jar file to my program.
>>
>> So, this is the source :
>>
>> import org.apache.commons.mail.SimpleEmail;
>> public class Main
>> {
>> public static void main(String args[])
>> {
>> try
>> {
>> SimpleEmail email = new SimpleEmail();
>> email.setDebug(true);
>> email.setHostName("smtp.myhost.com");
>> email.addTo("
foo@...", "foo bar");
>> email.setFrom("
john@...", "john doe");
>> email.setSubject("Test message");
>> email.setMsg("This is a simple test of commons-
>> email");
>> email.send();
>> }
>> catch(Exception e) { e.printStackTrace(); }
>> System.out.println("ok");
>> }
>> }
>>
>> The JAR file downloaded from the apache commons website is in the
>> same
>> directory of Main.java and is name email.jar .
>> I compile this way : javac -cp email.jar Main.java
>> No error, I execute : java Main.java
>> I have this error :
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError: Main/
>> java
>> Caused by: java.lang.ClassNotFoundException: Main.java
>> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
>> 301)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
>> 320)
>> Could not find the main class: Main.java. Program will exit.
>>
>> Same error if I try : java -cp email.jar Main
>>
>> Where do I do wrong ?
>>
>> Thanks folk !
>>
>> --
>>
>>
>> --
>> |
>> .:: Alfred Sawaya ::.
>> |
>> --
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
user-unsubscribe@...
>> For additional commands, e-mail:
user-help@...
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
user-unsubscribe@...
>> For additional commands, e-mail:
user-help@...
>>
>>
>
>
> --
>
>
> -- |
> .:: Alfred Sawaya ::.
> |
> --
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
user-unsubscribe@...
> For additional commands, e-mail:
user-help@...
>