Sunday, May 23, 2010

Felice's new bike

. . . is named Honeybee.

Felice's new bike

Friday, May 21, 2010

New logo

My girlfriend came up with a clever logo for my OrangeExtensions project.

OrangeExtensions logo

Picture (C) Felice Ford, 2010, released CC-BY-SA 3.0.

Friday, May 14, 2010

A First

Last night circa 1am was a big moment for me. My first open source contribution to a project that I didn't start. It was a bug fix for gtkjfilechooser, an effort to update Swing's file chooser for the Linux GTK look and feel. I look forward to continuing to develop this handy widget.

Wednesday, May 5, 2010

Packaging Java apps with native dependencies: Part I - Mac OSX

Packaging Java programs on Mac is easy with the JarBundler app OSX provides It will take your jar and turn it into an app, presto!
Unfortunately in some cases things are just a bit more complicated.

  • First of all, the JarBundler app doesn't provide command-line or automated usage, so creating the app for every release quickly becomes tedious. To solve that problem Seth Moratibo provides the wonderful JarBundler Ant Task.

  • Second, native dependencies are more difficult to stuff into your app. Sure, JarBundler (both Mac's and Seth Moratibo's) allows you to add the dylibs as "Additional Files and Resources," but that only works in the simple case. If your dylib dependency has another dylib it relies on, you're out of luck. When one dylib tries to call the other, the dynamic linker is ignorant of the directory containing the second dylib.

  • Not to worry, there's a quick fix. Changing your working directory to the folder containing the dylibs solves the problem, since the dynamic linker always looks in the current directory. But how do you refer to the current directory? Macs don't provide a symbol like $APP_ROOT. [Update: from Romain Kuntz's writeup I see there is also $APP_PACKAGE you can use.] In this case however you can benefit from the existence of the $JAVAROOT symbol. So without further adieu, here's my Ant task for packaging one of my Mac apps:
    <!-- Bundle jar into .app. -->
    <target name="package_mac_app"
    depends="package_jar, compile_native"
    description="bundle the runnable jar into a Mac Application">
    <taskdef name="jarbundler"
    classname="net.sourceforge.jarbundler.JarBundler"
    classpathref="buildtools"/>
    <echo message="CREATING MAC .app EXECUTABLE"/>
    <jarbundler
    dir="dist"
    name="PennTotalRecall"
    mainclass="control.Start"
    icon="icons/headphones.icns"
    jvmversion="1.5+"
    infostring="Penn TotalRecall"
    shortname="TotalRecall"
    bundleid="edu.upenn.cis.memory.totalrecall"
    jar="dist/PennTotalRecall.jar"
    workingdirectory="$JAVAROOT">
    <javafilelist dir="dylibs" files="libpenntotalrecall.dylib"/>
    <javafilelist dir="dylibs" files="libfmodex.dylib"/>
    </jarbundler>
    </target>
    In that task, libpenntotalrecall relies on libfmodex at runtime. Be sure the Ant JarBundler jar is in a directory called buildtools.

  • Third, you should put your app into a dmg image with a pretty background. It's what users expect from a professional application. Romain Kuntz has the definitive writeup on that subject, so I'll refer you there.