Q:

Getting error message "java.lang.ClassNotFoundException: javax.mail.internet.MimeMessage" while executing ant mail task

I tried to execute below mentioned ant mail task, I'm getting error message: java.lang.ClassNotFoundException: javax.mail.internet.MimeMessage.
I have created environment variable for ant.
Also placed mail.jar, activation jar & ant-javamail jar in lib folder as well as in eclipse -> preferences -> Global Entries. Anything else required for executing ant mail task? Please suggest.
<target description="Generates and send TestNG test reports" name="send-report">
    <mail mailhost="smtp.sears.com" mailport="25" user="kmart\vlakshm" password="AK230211$$" ssl="true" subject="Test build">
    <from address="vijayalakshmi.lakshmanan@searshc.com"></from>
     <replyto address="vijayalakshmi.lakshmanan@searshc.com"></replyto>
     <to address="vijayalakshmi.lakshmanan@searshc.com"></to>
     <message>Please find the attached report for Sears International smoke test results.</message>
         <attachments>
           <fileset dir="C:\\Documents and Settings\\vlakshm\\workspace\\INTL_REG\\test-output\\emailable-report.html">
            <include name="**/*.zip"/>
           </fileset>
         </attachments>
      </mail>
    </target>

In command prompt,executed below mentioned command
ant send-report

Getting below mentioned exception
build.xml:70: java.lang.ClassNotFoundException: javax.mail.internet.MimeMessage

        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at org.apache.tools.ant.taskdefs.email.EmailTask.execute(EmailTask.java:
452)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
        at org.apache.tools.ant.Main.runBuild(Main.java:851)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 0 seconds

A:

add mail.jar and activation.jar in ANT_HOME/lib or use both jar form your project/lib
    
        
        

