Search code examples
javamacosquicktime

Why does QuickTime QTSession.open fail when packaged using OSX Jar Bundler?


I am using QuickTime for Java to display video within a Java desktop application. Everything works fine when this application is built as a jar file, but for some reason when I use this maven plugin to package the application to look like a native OSX application bundle, the following code:

try {
  QTSession.open();
} catch (Throwable t) {
  logger.error("QTSession was unable to open", e);
}

throws the following error:

java.lang.UnsatisfiedLinkError: /System/Library/Java/Extensions/libQTJNative.jnilib: no suitable image found. Did find: /System/Library/Java/Extensions/libQTJNative.jnilib: no matching architecture in universal wrapper


Solution

  • QuickTime for Java only works in 32-bit mode. Despite having J2SE 5.0 (32-bit) set as the JVM for java applications, it would seem as though application bundles created by the osxappbundle-maven-plugin defaults to run on a 64-bit version of the JVM. Setting osxappbundle-maven-plugin to use a custom Info.plist that contains the following key:

    <key>LSArchitecturePriority</key>
    <array>
    <string>i386</string>
    <string>ppc</string>
    </array>
    

    Forces the application bundle to run in 32-bit mode and resolves the issue.

    Many thanks Vinegar for pointing me in the right direction.