title: Access parameters from custom URI scheme in Java application on OS X
body: <p>I've successfully added a custom URI scheme in info.plist on OS X so my Java 1.7 based application (written in Netbeans) is launched whenever the user enters &quot;myApp:SomeParameter&quot; in their browser:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;key&gt;CFBundleURLTypes&lt;/key&gt;
  &lt;array&gt;
      &lt;dict&gt;
          &lt;key&gt;CFBundleURLName&lt;/key&gt;
          &lt;string&gt;My App&lt;/string&gt;
          &lt;key&gt;CFBundleURLSchemes&lt;/key&gt;
          &lt;array&gt;
              &lt;string&gt;myApp&lt;/string&gt;
          &lt;/array&gt;
      &lt;/dict&gt;
  &lt;/array&gt;
  </code></pre>
  
  <p>I have also successfully added the corresponding registry entry for the application if installed on a Windows machine. The problem is that on the Windows platform I can easily pass on parameters (in the above case I want &quot;SomeParameter&quot; from the entered uri &quot;myApp:SomeParameter&quot;). It is simply passed on to the application main method as regular parameters, but this is not the case on OS X. I have done some research and tried <a href="https://stackoverflow.com/a/20225859/1222517">this solution</a> but it requires some Cocoa libraries and causes issues when compiled and run on Windows.</p>
  <p><strong>EDIT</strong>: I have tried to track down a version of AppleJavaExtensions that contains the com.apple.eawt.Application.setOpenURIHandler() but I've only found version 1.4 where it's missing. Any idea why?</p>
  <p>Is there another way to pass parameters from a custom URI scheme to a cross platform Java application running on Mac / OS X?</p>
  <p><strong>EDIT 2:</strong> Please see accepted answer below, but as a side note: we successfully experimented with a possible workaround using AppleScript as a middle-tier. The script in <a href="https://web.archive.org/web/20170314201849/http://jones.kaist.edu/notebook/2012/09/creating-a-custom-url-scheme-via-applescript-and-python.html" rel="nofollow noreferrer">this article</a> can be simplified to receive the full URL with parameters, and then invoke your Java based application with the query string as normal command line parameters.</p>