Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 23184 invoked from network); 19 Jun 2009 11:47:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Jun 2009 11:47:32 -0000 Received: (qmail 37924 invoked by uid 500); 19 Jun 2009 11:47:41 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 37820 invoked by uid 500); 19 Jun 2009 11:47:41 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 37810 invoked by uid 99); 19 Jun 2009 11:47:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Jun 2009 11:47:41 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [209.85.219.210] (HELO mail-ew0-f210.google.com) (209.85.219.210) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Jun 2009 11:47:30 +0000 Received: by ewy6 with SMTP id 6so2273320ewy.42 for ; Fri, 19 Jun 2009 04:47:10 -0700 (PDT) Received: by 10.210.115.15 with SMTP id n15mr770147ebc.39.1245412029316; Fri, 19 Jun 2009 04:47:09 -0700 (PDT) Received: from ?192.168.20.32? (jem75-8-88-170-103-188.fbx.proxad.net [88.170.103.188]) by mx.google.com with ESMTPS id 10sm240894eyz.41.2009.06.19.04.47.07 (version=SSLv3 cipher=RC4-MD5); Fri, 19 Jun 2009 04:47:08 -0700 (PDT) Message-ID: <4A3B7ABB.1020508@reseau2000.net> Date: Fri, 19 Jun 2009 13:47:07 +0200 From: Alfred Sawaya User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: Commons Users List Subject: Re: Error while executing code with SimpleEmail class References: <4A3B78F7.9050401@reseau2000.net> <400B1E0D509AB14C95FFDC1DE303B9A83F6A927A92@EXCLU2K7.hi.inet> In-Reply-To: <400B1E0D509AB14C95FFDC1DE303B9A83F6A927A92@EXCLU2K7.hi.inet> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org 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@tid.es > TELEFONICA I+D > Emilio Vargas, 6 28043 Madrid (SPAIN) Tel: +34 91 337 2614 > __________________________________________________________________ > ________________________________________ > De: Alfred Sawaya [alfred@reseau2000.net] > Enviado el: viernes, 19 de junio de 2009 13:39 > Para: user@commons.apache.org > 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@bar.com", "foo bar"); > email.setFrom("john@doe.com", "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@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > -- -- | .:: Alfred Sawaya ::. | -- --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org