Reputation: 13739
I have a javamail app that works fine in the Android/Eclipse environment, but throws the following in NetBeans (porting Android app to Desktop):
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed boundary="----=_Part_0_7749469.1284737984291"
I found a workaround here, but can't figure out how to apply it in NetBeans. I have already added mail.jar to my NetBeans compile time libraries but don't understand how to set the NetBeans boot class path to include mail.jar as suggested in the workaround. From http://www.opensubscriber.com/message/[email protected]/7570201.html
JAF uses the context class loader to load classes. If that fails, it uses the class loader that loaded the JAF classes.
When JAF is packaged with the application, the JAF classes are loaded by the same class loader as the other application classes, so even if the context class loader isn't set JAF can find the other application classes.
When JAF is part of the JDK, the JAF classes are loaded by the system class loader. Without the context class loader being set, JAF has no way to find the appropriate class loader to load application classes.
(Since JavaMail is packaged with the application, the JavaMail class are treated the same as application classes.)
A workaround is to set the boot class path to include mail.jar.
How do I set the NetBeans boot class path to include mail.jar?
Upvotes: 0
Views: 5080
Reputation: 16528
Unless you're writing a NB plugin, you don't want it on the NB boot class path. You want it on your project's class path.
First you need to add mail.jar as a library.
Tools > Libraries
New Library
Library name
Java MailLibrary Type:
Class LibrariesOK
Add JAR/Folder
Add JAR/Folder
OK
Now, add the library to your project
File > Project Properties
Libraries
Compile
tabAdd Library
Import Libraries
step here)OK
That should be it.
Note that you will needs to ensure the javamail.jar is distributed with your application; either directly or through a jnlp file.
Upvotes: 1