1

On Mac OS X opening my document by double clicking at the document fails if my application is not already running

When launching my drawing application by double clicking at a document Finder shows a dialog which says:

The document "test.jdwg" could not be opened. Application "jDraft" cannot open files in the "jDraft Document" format.

enter image description here

This message dialog appears before my application has time to even put up its splash screen, however the application is launched in the background (I see the splash screen) and when I double click again at the document my application correctly opens it.

As a background this application has been working (in this respect) for years. This problem appeared now when I'm trying to use the JWrapper to package my application.

Following is Info.plist for my application.

I suspect this maybe related to the way JWrapper lauches or forks the JVM to run the application ... hard to tell because JWrapper is closed source and thus pretty much beyond debuggin.

Has anyone managed to make file associations work with JWrapper on Mac OS X?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleName</key>
    <string>jDraft</string>
    <key>CFBundleIdentifier</key>
    <string>jwrapper.osx.jDraft</string>
    <key>CFBundleVersion</key>
    <string>43568712</string>
    <key>CFBundleAllowMixedLocalizations</key>
    <string>true</string>
    <key>CFBundleExecutable</key>
    <string>osxwrapper</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>LSUIElement</key>
    <true/>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleIconFile</key>
    <string>AppLogo.icns</string>
    <key>NSHighResolutionCapable</key>
    <true/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>jDraft Drawing 2</string>
            <key>LSHandlerRank</key>
            <string>Default</string>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleTypeIconFile</key>
            <string>jDraft-doc-jdwg.icns</string>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>jdwg</string>
            </array>
            <key>CFBundleTypeOSTypes</key>
            <array>
                <string>jdwg</string>
            </array>
        </dict>
    </array>
</dict>
</plist>
Hendrik
  • 5,085
  • 24
  • 56
nyholku
  • 456
  • 3
  • 15
  • I'm using the InfiniteKind AppBundler fork and launching via *Open With* works like a charm. So I guess you're right—it's probably JWrapper. Because it's closed-source and does not have a public bug database, I suggest contacting their support. Considering their per seat prices, they hopefully feel obliged to help you. – Hendrik May 04 '16 at 07:54
  • Thanks for the info. I've contacted them for this and and another question and never received any feedback, not directly, not here. They say that stackoverflow is where they support people but so far I've not seen much support from them. Pitty really, as the product is very nice and polished and the end user experience (which is what I care about) is pretty damn good. I guess the paying customers get better service but I would have expected some response from them as there are not that many questions in the SO to overwhelm them. Would be nice if I could stop wasting my time with JWrapper. – nyholku May 05 '16 at 05:04

1 Answers1

1

I think I can confirm this is a JWrapper issue and one that cannot be satisfactorily solve at this point in time.

I copied all the stuff from the JWrapper produced bundle to my original app bundle which does not have this problem (by amazing luck there are no conflicting file names!).

My app still worked beautifully.

I then changed this one attribute in the 'Info.plist'

<key>CFBundleExecutable</key>
<string>JavaApplicationStub</string>

to

<key>CFBundleExecutable</key>
<string>osxwrapper</string>

and the problem becomes back, meaning that I get the 'cannot open' dialog while the application launches.

So my conclusion is that this is not Mac OS / Finder that is doing this and putting up the dialog but it is the JWrapper osxwrapper that puts up the dialog and fails to pass the document to my Java code or swallows the 'open document event'.

I also tried the osxlauncher executable in that the JWrapper puts into the .app/Contents/MacOS folder -- same result.

Maybe there is a way to tell osxwrapper that my application can open these document but I have not been able to find any documentation. Or maybe this is a not supported feature, which would be a serious omission in an otherwise great product.

Either way it would be nice to get a definitive answer from JWrapper people so that I could stop wasting my time with this.

nyholku
  • 456
  • 3
  • 15