how to export mail.jar ?
Hi to everybody!
i'm writing a desktop application that needs to send e-mail (i'm using NetBeans do develop it). These are the steps i've done:
* I've downloaded the javamail-1.4 and jaf-1.1 (activation) libraries and i've added them into my project using "Libraries -> AddLibrary" as i've always done. And everything works.
* I've written my code (i.e. an emailSender class) and compiled it. And everything works.
* I run the application from NetBeans. And everything works (the email are sent).
* I've added into build.xml the code
<target name="-post-jar">
<jar update="true" destfile="${dist.jar}" manifest="manifest.mf">
<zipfileset src="${libs.swing-layout.classpath}"/>
<zipfileset src="C:\\Programs\\Java\\jaf-1.1\\activation.jar"/>
<zipfileset src="C:\\Programs\\Java\\javamail-1.4\\mail.jar"/>
</jar>
</target>
to export the myproject.jar file as an executable on other systems but when i double-click on the jar i see the error:
Could not find the main class. Program will exit
* Then i've removed the two zipfileset tags and left the target tag as
<target name="-post-jar">
<jar update="true" destfile="${dist.jar}" manifest="manifest.mf">
<zipfileset src="${libs.swing-layout.classpath}"/>
</jar>
</target>
Thus the application still run correctly if loaded from NetBeans but if loaded by double-clicking the jar file (after a rebuild of the project) it throws the following exception:
class java.lang.NoClassDefFoundError
javax/mail/MessagingException
Of course id does not fount the definition of MessagingException.
* I've tryed to add the mail.jar, using the jar command line, into myproject.jar but i haven't solved the problem.
So, how could i add into myproject.jar the mail library without having the NoClassDefFoundError exception? I think the error appear only when exporting into the jar the mail api. But the manifest.mf file always contains
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
Main-Class: Main.Main
and it looks correct.
Thank you in advance !!
alevincio

