I think my jar to work needs mail.jar plus the others class files what to do?

I used
jar cmf SMTPClient.mf SMTPClient.jar SMTPClient.class SMTPClient$SendAction.class SMTPClient$UpdateListener.class mail.jar SMTPClient.java

but gives (how include another jar in my jar and keep package structure?)

C:\Users\User\Documents\TextBooksDataFiles\Java Network Programming, 3rd Edition\jnp3examples\examples\19>jar cmf SMTPClient.mf SMTPClient.jar SMTPClient.class SMTPClient
$SendAction.class SMTPClient$UpdateListener.class mail.jar SMTPClient.java

C:\Users\User\Documents\TextBooksDataFiles\Java Network Programming, 3rd Edition\jnp3examples\examples\19>java -jar SMTPClient.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Message
        at SMTPClient.<init>(SMTPClient.java:115)
        at SMTPClient.main(SMTPClient.java:296)
Caused by: java.lang.ClassNotFoundException: javax.mail.Message
        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)
        ... 2 more
6 Years
Discussion Span
Last Post by lse123

you can use this code instead of adding one by one class file

jar cmf SMTPClient.jar *.class

*.class will collect all the class file which is been created by your java file.

i hope this code will help you.

Edited by DeadSoul: n/a


first time running jars[gui] non-success, needed anything else from mail.jar?

in shortcut
target:"C:\Users\User\Documents\TextBooksDataFiles\Java Network Programming, 3rd Edition\jnp3examples\examples\19\SMTPClient.jar"
startin:"C:\Users\User\Documents\TextBooksDataFiles\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

this is correct ... how many lines must follow: SMTPClient?

Manifest-Version: 1.0
Class-Path: lib/mail.jar
Created-By: 1.6.0_15 (Sun Microsystems Inc.)
Main-Class: SMTPClient

in this case mail.jar needed ONLY outside the SMTPClient.jar?

Edited by lse123: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.