JVMs have a GPL’d implementation of the JavaMail API thanks to GNU!

This has been around for a while, but I’ve only just stumbled across this as I have been looking at into the licensing of some 3rd party jars we use at work.

GNU have a free implementation of the Sun JavaMail API specification, which means we now have some more GPL’d jars we can use.

So lets build em!
First we need to download all the source:

wget http://ftp.gnu.org/gnu/classpathx/activation-1.1.1.tar.gz
wget http://ftp.gnu.org/gnu/classpath/inetlib-1.1.1.tar.gz
wget http://ftp.gnu.org/gnu/classpathx/mail-1.1.2.tar.gz
NOTE: The above links are on the javamail link above, so you can just download it from there!

Extract and start building.. as an example I’ll just use the ‘/tmp’ directory, remember to change this to your desired location.

tar -xvf activation-1.1.1.tar.gz
tar -xvf inetlib-1.1.1.tar.gz
tar -xvf mail-1.1.2.tar.gz

We need to build activation.jar and inetlib.jar first as they are dependancies of the GNU mail api.

First build activation.jar:

cd activation-1.1.1/
cd ..

Then build inetlib.jar:

cd inetlib-1.1.1/
cd ..

Now with those jars built we need to build the gnumail jars:

cd mail-1.1.2/
./configure --with-activation-jar=/tmp/activation-1.1.1/ --with-inetlib-jar=/tmp/inetlib-1.1.1/
cd ..

Lets move all the Jar files into /tmp so I can show you them all:

cp activation-1.1.1/*.jar .
cp inetlib-1.1.1/*.jar .
cp mail-1.1.2/*.jar .

ws -l *.jar
-rw-r–r– 1 matt matt 44375 2009-06-12 15:53 activation.jar
-rw-r–r– 1 matt matt 163942 2009-06-12 15:54 gnumail.jar
-rw-r–r– 1 matt matt 95250 2009-06-12 15:54 gnumail-providers.jar
-rw-r–r– 1 matt matt 182002 2009-06-12 15:53 inetlib.jar

Now just put them in your Java path and away you go!

Happy GNU Java’n