This discussion is archived
6 Replies Latest reply: Dec 5, 2012 4:31 AM by edward17 RSS

OPening a browser in JavaFX - MacOS

edward17 Newbie
Currently Being Moderated
I am trying to open a native browser in MacOS.

I have this code:
        if(Desktop.isDesktopSupported()) {
            Desktop desktop = Desktop.getDesktop();
  ...
            desktop.open(temp);
       }
But it fails the isDesktopSupported test.

So I tried this:
  String osName = System.getProperty("os.name");
     if (osName.startsWith("Mac OS")) {
        Class fileMgr = Class.forName("com.apple.eio.FileManager");
        Method openURL = fileMgr.getDeclaredMethod("openURL",
           new Class[] {String.class});
        openURL.invoke(null, new Object[] {url});
        }
but on the call to openURL.invoke() it goes off to lala land , never to respond

Works fine under Windows. Any thoughts? Suggestions? Translation re: what is happening (I am new to MacOS)

As to the question I KNOW will be asked, I am not using Webview here because I don't wnt to have to rebuild the Print functionality offered by native browsers...

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points