Crash in OSXAPP_SetApplicationDelegate

Marco Dinacci marco.dinacci at gmail.com
Tue May 22 07:24:15 PDT 2012


Hi Anthony,

> Just wanted to ask you: could you provide the shortest possible test code
> and exact instructions on how to bundle it, so that we could try and
> reproduce this issue locally? Thanks in advance!

Here below the shortest possible test code I could do.
You need appbundler to build the .app and you need to set the
${runtime} property in the ant file to point to your OpenJDK build.
Then in a terminal just type "ant" and after a few seconds you should
have SwingTest.app in the same dir.
Then create a test file say test.zzz and open the app by typing:

$ open -a SwingTest.app test.zzz

Alternatively, you can specify the app to register with all zzz files
and then just type open test.zzz or double click on any zzz file.
To do it, attach this XML inside the plist file in
SwingTest.app/Contents/Info.plist

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>zzz</string>
        </array>
        <key>CFBundleTypeName</key>
        <string>ZZZ Data</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
    </dict>
</array>

=== SwingTest.java ===

public class SwingTest {
    public static void main(String[] args)  {
         Toolkit t = Toolkit.getDefaultToolkit();
    }
}

=== build.xml ===

<project name="swingtest" default="bundle" basedir=".">

  <property name="runtime" value="./vm/jdk1.7.0.jdk"/>
  <property name="bundle.name" value="SwingTest"/>
  <property name="dist" value="."/>

  <target name="bundle" depends="clean,jar">
    <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask"/>
    <bundleapp outputdirectory="${dist}"
        name="${bundle.name}"
        displayname="${bundle.name}"
        identifier="${bundle.name}"
        shortversion="1"
        mainclassname="SwingTest"
        copyright="2012 SwingTest"
        applicationCategory="public.app-category.finance">
        <runtime dir="${runtime}/Contents/Home"/>
        <classpath file="${dist}/SwingTest.jar"/>
    </bundleapp>
  </target>

  <target name="jar" depends="compile">
    <jar destfile="${dist}/SwingTest.jar" manifest="MANIFEST.TXT">
         <fileset dir="${dist}" includes="*.class"/>
    </jar>
  </target>

  <target name="compile">
    <javac target="1.5" source="1.5" srcdir="." debug="0" optimize="1"
          destdir="${dist}"
          includes="SwingTest.java"
          includeantruntime="1"
        />
  </target>

  <target name="clean">
    <delete dir="${dist}/SwingTest.app"/>
    <delete file="${dist}/SwingTest.jar"/>
    <delete file="SwingTest.class"/>
  </target>

</project>

== MANIFEST.TXT ==

Main-Class: SwingTest


Thanks for looking into this, let me know if I can do anything else to help.

Best,
Marco


More information about the macosx-port-dev mailing list