title: Mac: How to assign a file extension to be opened with my java .app application?
body: <p>I have created a Java application and created a Mac .app file from it to run simply on Mac OS X. The application can create special project files and save them with the extension *.ksdi so the user can easily run those project files again and edit them.</p>
  
  <p>What I would like to do is allow the user who installed the application on his Mac to be able to double click those *.ksdi files to automatically run the program and automatically load the project file. How can I do that in Mac?</p>
  
  <p>Can I assign an extension to my Mac program through a script or something like that so user won't have to assign the extension to the program manually?</p>
  
  <p><strong>Update: Trial solution:</strong></p>
  
  <p>I have read in another post that I should add a key to the *.plist file to accomplish this, so I added this to it:</p>
  
  <pre><code>&lt;plist&gt;
      &lt;dict&gt;
          &lt;key&gt;CFBundleDocumentTypes&lt;/key&gt;
          &lt;array&gt;
              &lt;dict&gt;
                  &lt;key&gt;CFBundleTypeRole&lt;/key&gt;
                  &lt;string&gt;Viewer&lt;/string&gt;
  
                  &lt;key&gt;LSIsAppleDefaultForType&lt;/key&gt;
                  &lt;true/&gt;
  
                  &lt;key&gt;LSItemContentTypes&lt;/key&gt;
                  &lt;array&gt;
                      &lt;string&gt;public.ksdi&lt;/string&gt;
                  &lt;/array&gt;
              &lt;/dict&gt;
          &lt;/array&gt;
      &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>I saved the plist file, but I do not know how to activate this!
  I have run the application, restarted my mac, but still when double clicking any ksdi file it doesn't open it with the program... Any help?</p>