title: java Desktop browse: how to get the current URL?
body: <p>I am trying to implement authentication of my standalone java application at VKontakte - Russian social network.</p>
  
  <p>I want to avoid requesting a password from the user, so my method is like this:</p>
  
  <ol>
  <li>open default browser with a special generated URL</li>
  <li>in the opened page user clicks Accept button</li>
  <li>browser gets redirected to a special URL from where I can extract access_token which is supposed to be used for any other further request.</li>
  </ol>
  
  <p>But the problem is that I do not know how to get that new URL from the browser.
  The code I am using is</p>
  
  <pre><code>if (Desktop.isDesktopSupported()) {
          Desktop desktop = Desktop.getDesktop();
          if (desktop.isSupported(Desktop.Action.BROWSE)) {
              try {
                  URI uri = new URI("some URL here");
                  desktop.browse(uri);
  </code></pre>