Java Mail


What do we need to do if we face the "addBodyPart is undefined for type Multipart" problem?

Your program may be failing with "Uncompiled" errors, and when you check your Eclipse, you see the "addBodyPart is undefined for type Multipart" error. When this happened to me, I do the following:

  1. Go to Java Build Path
  2. Click on the Order and Export tab
  3. Select activation.jar and move it to the top
  4. Select mail.jar and move it right below activation.jar

Inside the javac command (in the build.xml file), I also specified the activation.jar and mail.jar:

<javac optimize="no" debug="yes" srcdir="${src}" destdir="${build}">
        <pathelement location="helperjars/activation.jar"/>
        <pathelement location="helperjars/mail.jar"/>
        <fileset dir="helperjars/" casesensitive="no">
            <include name="**/*.jar"/>
            <include name="**/*.zip"/>
            <exclude name="activation.jar"/>
            <exclude name="mail.jar"/>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License