• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Distributing a JavaMail Application?

 
Craig O'Brien
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have written a Swing email client/mail manager in JBuilder and everything works great in the development environment. However, when I package it up for distribution I get errors when trying to send or receive.
Sending -- rfc882 error
Receiving -- no such provider exception.
This points to a Provider mapping issue. I notice, however, that JBuilder does not include any special mappings and the app works in that environment.
I have read Sun's "Guide for Service Providers" and created both javamail.properties and javamail.address.map files which are placed in my <javahome>/lib directory. hmmmmm???
All classpaths etc are correct and double checked. All pertinent classes are bundled up in my main jar. I distribute a jre 1.3.1 and startup files with the package.
Any ideas?
Thanks,
Craig
------------------
SCJP2
 
Craig O'Brien
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello its me again,
Well just because I'm not a lose ends guy and I'm sure that I am not the only one who has come across this....
After spending hours searching every possible forum, all answers point in some way or another to a classpath issue.
Inside the mail.jar are the two all important mapping files. If your IDE includes the mail.jar file (or any part of it) in your distribution jar, it will obscure the mail.jar's manifest so it simply won't find them. It also puts blinders on it so it cannot find the classpath. I tried extracting the files and placing them into the META-INF directory in my jar, I tried modifying my jar, modifying the manifest, jaring everything manually, placing the files in every possible location. I tried many different compilations of my jar, I tried including the classpaths everywhere... There was just no way that I could get the mail.jar to read the classpath. Somehow during distribution phase, JBuilder seems to create something which obscures the mail.jar's mapping files and does not allow it the scope to find the classpath.
Four hours later, I decided to just place the mail.jar and the activation.jar into the /jre/lib/ext directory and everything worked fine. The classloader cannot miss these jars that way and they are free of the distribution jar. This isn't ideal as it somewhat binds the application to the specific jre that I give them. I want to be able to distribute this to non-technical people and the thought of making them make classpath and other adjustments is exactly the opposite direction that I want to go with this project.
The real long term answer is probably to create my own provider etc which I will do later in the development process.
I'm still interested in comments if anyone has any good insights.
Anyways, Happy coding.
Cheers,
Craig
------------------
SCJP2
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic