Results 1 to 11 of 11
- 06-05-2010, 07:47 PM #1
Senior Member
- Join Date
- Oct 2008
- Posts
- 116
- Rep Power
- 0
simple send email APP, but when press send button appeared:
I run
java -jar SMTPClient.jar // run from CLI
simple send email APP[GUI], but when press send button appeared:
Java Code:C:\Users\User\Documents\TextBooksDataFiles\Java Network Programming, 3rd Edition\jnp3examples\examples\19>java -jar SMTPClient.jar Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: SMTPClient$SendAction$1 at SMTPClient$SendAction.actionPerformed(SMTPClient.java:270) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6263) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:6028) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4630) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168) at java.awt.Container.dispatchEventImpl(Container.java:2085) at java.awt.Window.dispatchEventImpl(Window.java:2475) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) Caused by: java.lang.ClassNotFoundException: SMTPClient$SendAction$1 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) ... 26 more
- 06-06-2010, 02:47 PM #2
Member
- Join Date
- Jun 2010
- Location
- Berlin
- Posts
- 22
- Rep Power
- 0
Well, it would be quite nice to get some more information. Of course anyone who wants to help you could search for this .jar file and maybe someone will guess that it is related to some O'Reilly book, but this could (way easier) be mentioned by you.
While I don't have this book (and therefore no access to the .jar file), I can't really help you without further infos. I found some example code that I could download, but the archive contains only .java files. So have you created the package by yourself?
The exception that is thrown is allready telling you what's going on. You trigger some event that refers to some function of the SMTPClient class, which is not known. This might be caused by some missing library. Just try to unpack the .jar file (if it doesn't work directly rename it to a .zip archive). You will find some folder META-INF which should contain the manifest.MF file. This file should contain some information, like the class to run as the main. Is there some line starting by "Class-Path:"? If so, you have to ensure that these files or (relative) pathes are accessible.
Best regards,
Herr K.
- 06-06-2010, 03:45 PM #3
Where did you get the jar file? It appears to be missing a class definition file.
- 06-06-2010, 03:49 PM #4
Senior Member
- Join Date
- Oct 2008
- Posts
- 116
- Rep Power
- 0
Manifest-Version: 1.0
Class-Path: lib/mail.jar
Created-By: 1.6.0_15 (Sun Microsystems Inc.)
Main-Class: SMTPClient
this reads is it correct? book [ch 19 / file name same] oreilly:
Java Network Programming, 3rd Edition
but modified code myself.
may zip file/folders and attach it to try it you?
in shortcut
target:"C:\Users\User\Documents\TextBooksDataFiles \Java Network Programming, 3rd Edition\jnp3examples\examples\19\SMTPClient.jar"
startin:"C:\Users\User\Documents\TextBooksDataFile s\Java Network Programming, 3rd Edition\jnp3examples\examples\19"
the jar is in the
C:\Users\User\Documents\TextBooksDataFiles\Java Network Programming, 3rd Edition\jnp3examples\examples\19\lib\mail.jar
only from running [CLI] the- java SMTPClient .class -email delivered
- 06-06-2010, 03:58 PM #5
Senior Member
- Join Date
- Oct 2008
- Posts
- 116
- Rep Power
- 0
I attach without mail.jar in .../lib/ , well?
I attach without mail.jar in .../lib/ , well?
- 06-06-2010, 04:00 PM #6
Yes, the manifest looks ok. Without the correct Main-Class: line, the JVM wouldn't be able to start the program.
When you look in the jar file, do you see the file: SMTPClient$SendAction$1.class
Did you create an anonymous class in SendAction?modified code myself
Just downloaded your zip file. I searched the .jar file with a tool I have and got this report:
How are you generating the .jar file? You need to add the missing class#Searching C:\Documents and Settings\Owner\My Documents\Downloads\SMTPClient\SMTPClient.jar for SMTPClient
SMTPClient
SMTPClient$1
SMTPClient
SMTPClient$2
SMTPClient
SMTPClient$3
SMTPClient
SMTPClient$4
SMTPClient
SMTPClient$SendAction
SMTPClient
SMTPClient$SendAction$1 >>>> class NOT found! <<<<
SMTPClient$UpdateListener
SMTPClient
# Found 8 classes. 1 NOT found.Last edited by Norm; 06-06-2010 at 04:03 PM.
- 06-06-2010, 04:12 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
- 06-06-2010, 05:13 PM #8
Senior Member
- Join Date
- Oct 2008
- Posts
- 116
- Rep Power
- 0
I added SMTPClient$SendAction$1 and now works, thks!
in the above class name "$" show inner classes? may included in any order in->...?
jar cmf SMTPClient.mf SMTPClient.jar SMTPClient.class SMTPClient$SendAction.class SMTPClient$SendAction$1.class SMTPClient$UpdateListener.class SMTPClient$1.class SMTPClient$2.class SMTPClient$3.class SMTPClient$4.class SMTPClient.java
- 06-06-2010, 05:57 PM #9
You can use a wild card (*) in the jar statement: SMTPClient*.class vs the explicit list which can change if you add another anonymous class.
- 06-06-2010, 06:38 PM #10
Senior Member
- Join Date
- Oct 2008
- Posts
- 116
- Rep Power
- 0
What you mean "which can change if you add another anonymous class. ", are you mean use same statement to recreate jar, in case modify file.java?
- 06-06-2010, 06:49 PM #11
Similar Threads
-
how to send an email
By Hussain Ali in forum Advanced JavaReplies: 9Last Post: 03-19-2010, 07:44 AM -
how to send an email
By painamrata in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 02-22-2009, 04:28 PM -
send email using JMS
By Heather in forum Advanced JavaReplies: 9Last Post: 01-07-2009, 03:04 PM -
send email using apache commons email
By jnamendi in forum JavaServer Faces (JSF)Replies: 0Last Post: 10-14-2008, 05:55 PM -
Email send problem
By serjant in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 09-19-2008, 02:15 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks