How to associate a file type with a (my) Java application on OSX?

狂风中的少年 提交于 2019-12-13 00:41:19

问题


I want to be able to double click on textfile.myext and have my java program open and handle the file.

How should I go about making my program accept files that are set as default to open in said program?

What are the steps and what is passed to the program after something is set as default?


回答1:


Deploy the app. using Java Web Start, which provides..

..splash screens, desktop integration, file associations, automatic update (including lazy downloads and programmatic control of updates), partitioning of natives & other resource downloads by platform, architecture or Java version, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions..

To see how it is done, visit the demo. of the file services, the filetest.zip contains the source, launch file and build file. The demo. ..

..prompts the user to associate file extension .zzz (simply a file type unlikely to clash with existing file associations) of content type text/sleepytime.

If the user asks to open a file, the arguments will be -open path/to/file.name or for print it will be -print path/to/file.name.

JWS is supplied with the JRE, and works on OS X, Windows & *nix.



来源:https://stackoverflow.com/questions/9659543/how-to-associate-a-file-type-with-a-my-java-application-on-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!