4

There is one place in our app where we need to launch a web page. So we do a

Desktop.getDesktop().browse(new URI(url));

This works fine in Windows and in OSX 10.11.

When we run this on OSX 10.12 - nothing happens. No exceptions, no browser, nothing.

More Info: Desktop.isDesktopSupported(), Desktop.getDesktop().isSupported(Desktop.Action.BROWSE) both return true.

The other thing that may affect this is that our Java OSX app is NOT signed. (still seems like Java should throw an exception if it can't launch the browser.)

CasaDelGato
  • 1,263
  • 1
  • 12
  • 29
  • Can you please post a [**full** MCVE?](http://stackoverflow.com/help/mcve) Does the code check for desktop support? _"On some platforms the Desktop API may not be supported; use the `isDesktopSupported()` method to determine if the current desktop is supported."_ – Matt Ball May 15 '17 at 18:32
  • MCVE - no. Building a Java app bundle on the Mac is a rather complicated process. – CasaDelGato May 15 '17 at 20:29
  • What's in `url`? – Matt Ball May 15 '17 at 20:38
  • If it's any consolation, it seems like others have run into this silent failure before you: https://stijndewitt.com/2010/09/22/java-awt-desktop-open-fails-silently-without-exception/ and http://stackoverflow.com/q/7201722/139010 – Matt Ball May 15 '17 at 20:41
  • Url is to a remote service. Entering the URL in a web browser manually works. it ONLY fails if we try this on OSX 10.12. – CasaDelGato May 15 '17 at 20:43
  • Well, I've found a partial workaround. Use Runtime.getRuntime().exec("open " + url); That will at least launch the browser - BUT the browser doesn't take over the menu bar. The menu bar seems to actually be disabled - until you launch some OTHER application. Weird... – CasaDelGato Jun 02 '17 at 17:14
  • Except - that workaround doesn't work on 10.12. (was testing on wrong system.) I have found that if Safari is already running, the Desktop.browse() method works just fine. It's only if Safari is NOT running that it fails. – CasaDelGato Jun 21 '17 at 20:32
  • We've given up. If our app is running on OSX 10.12, it now copies the URL to the clipboard, tells the user to startup the browser, and paste in the URL. – CasaDelGato Jun 22 '17 at 20:03

0 Answers0