I would like to enable the open file associated with my application by double-clicking on the Mac. This question has been asked (many) times, see, For example,
Double-click a document file in Mac OS X to open a Java application
However, it seems that changes have occurred since 2009 (when the decision was published). This solution was effectively based on a 2004 article
https://today.java.net/pub/a/today/2004/01/05/swing.html
and relied on two pieces of the puzzle:
1. A Java program should register a file open event and act accordingly. This was done using application adapters and com.apple.eawt applications. 2. The OS should be familiar with the extension that runs with CFBundleDocumentTypes enter the package .plist.
The constructs used by com.apple.eawt in 2004 are depreciated, as mentioned in several discussions, including
What is the alternative to using the deprecated com.apple.eawt.ApplicationAdapter in Java Swing applications on a Mac? (February 11) It is noted that OpenFilesHandler replaces worn-out designs. The link to the API document mentioned in the answer no longer works, so it’s not immediately clear how to use this construct. I found the following link explaining the reasons for the impairment, but the documentation link is also deprecated:
http://lists.apple.com/archives/java-dev/2012/Jan/msg00101.html
I could not find online documentation for the updated API. The Apple Developer site also refers to examples in X code that are not in the version I have (5.0.2)
(2012)
https://stackoverflow.com/questions/8857431/java-mac-jdk-7-beta-apple-application-listener-no-longer-works
OpenFilesEvent jdk6 jdk7-, , jdk7-.
, 2012 , OpenFilesHandler .
openFileEvent MacOSX ( )
, , , .
: Java Web Start, . - .plist.
, CFBundleDocumentTypes UTExportedTypeDeclarations. .
app bundler .plist, .plist.
, info.plist
info.plist:
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>JavaAppLauncher</string>
<key>CFBundleIconFile</key>
<string>myIcons.icns</string>
<key>CFBundleIdentifier</key>
<string>mypackage.MainClass</string>
<key>CFBundleDisplayName</key>
<string>MyProgram</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>ProgramName</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>NOTICES.txt</string>
<key>JVMRuntime</key>
<string>jdk1.7.0_21.jdk</string>
<key>JVMMainClassName</key>
<string>mypackage.MainClass</string>
<key>JVMOptions</key>
<array/>
<key>JVMArguments</key>
<array/>
<key>UTExportedTypeDeclarations</key>
<dict>
<key>UTTypeIdentifier</key>
<string>com.myCompany.xxx</string>
<key>UTTypeReferenceURL</key>
<string>http://myCompany.com/xxx.html</string>
<key>UTTypeDescription</key>
<string>My program file</string>
<key>UTTypeIconFile</key>
<array>
<string>myIcons.icns</string>
</array>
<key>UTTypeConformsTo</key>
<array>
<string>com.apple.package</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>apn</string>
</dict>
</dict>
<key>CFBundleDocumentTypes</key>
<dict>
<key>CFBundleTypeName</key>
<string>y program file</string>
<key>CFBundleTypeIconFiles</key>
<array>
<string>myIcons.icns</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<string>com.myCompany.xxx</string>
</dict>
</dict>
</plist>
info.plist : , , .
, ( ), ( , ). . ,
iconutil png,
https://apple.stackexchange.com/questions/59561/where-did-icon-composer-go-from-xcode
, - , . , , . , , .
, ,
OSX Association
, Jar Bundler, ( ) AppBundler.
-
http://www.tekrevue.com/tip/rebuild-launchservices-fix-duplicate-entries-os-xs-open-menu/
.
, ,
openFileEvent MacOSX ( )
OpenFilesHandler, UTExportedTypeDeclarations .
whiskeyspider , , . , .