2 Replies Latest reply: Nov 29, 2012 10:46 PM by 976407 RSS

    How to associate a file extension to my javafx desktop application?

    976407
      I have a javafx2 desktop application, I want to associate a certain kind of file with my application(like *.xxx), when the user double clicked the file, the system will start my application.
      I notice Scene Builder have that behavior, when double click *.fxml, Scene Builder will be launched.
      How could I do that for my own app, I look through Oracle's Packaging Document, and did not find anything helpful, maybe there is something I missed.
      Could anyone help? Thanks a lot!

      Edited by: user2027732 on Nov 27, 2012 1:29 AM
        • 1. Re: How to associate a file extension to my javafx desktop application?
          yves joan
          If your application is a self-contained as produced by the FX packager there isn't support for file association yet, but it will come at some point: see http://javafx-jira.kenai.com/browse/RT-23918
          For the time being you've to manage it in an OS dependent manner:
          - on Mac the post-install script that FX packager calls can be customized to process the Info.plist. How to create file association in Info.plist is described in MacOS docs.
          - on Linux you can use too the post install scripts too, commands to call are either RPM or Debian stuff.
          - on Windows the file association management is delegated to the "companion" software you've decided to use. If it's Inno Setup as suggested in FX docs you can then use a custom -post-image.wsf.

          Regards
          • 2. Re: How to associate a file extension to my javafx desktop application?
            976407
            Thank you yves joan , your post is really helpful, I've make my app get that behavior on Mac.
            There is another problem I met, How can I get the file path which the user double clicked, I try to get it from main method's agrs and Application.getParameters().
            None of them work for me, do you have any idea on this?