Commit 8256b86b authored by Christian Schudt's avatar Christian Schudt

Launcher: Use Desktop.getDesktop().browse().

The BrowserLauncher class seems to be really outdated (from 2001) and it doesn't even launch the browser on my Mac OS X.

Since Java 1.6, there is java.awt.Desktop, which can open a browser as well, so let's use that one.
parent 7e628c51
...@@ -25,6 +25,7 @@ import java.awt.BorderLayout; ...@@ -25,6 +25,7 @@ import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Graphics; import java.awt.Graphics;
...@@ -50,6 +51,7 @@ import java.io.InputStream; ...@@ -50,6 +51,7 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.Writer; import java.io.Writer;
import java.net.URI;
import java.net.URL; import java.net.URL;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
...@@ -278,8 +280,7 @@ public class Launcher { ...@@ -278,8 +280,7 @@ public class Launcher {
} }
else if ("Launch Admin".equals(e.getActionCommand())) { else if ("Launch Admin".equals(e.getActionCommand())) {
launchBrowser(); launchBrowser();
} } else if ("Quit".equals(e.getActionCommand())) {
else if ("Quit".equals(e.getActionCommand())) {
stopApplication(); stopApplication();
System.exit(0); System.exit(0);
} }
...@@ -589,9 +590,9 @@ public class Launcher { ...@@ -589,9 +590,9 @@ public class Launcher {
securePort = securePortElement.getTextContent(); securePort = securePortElement.getTextContent();
} }
if ("-1".equals(port)) { if ("-1".equals(port)) {
BrowserLauncher.openURL("https://127.0.0.1:" + securePort + "/index.html"); Desktop.getDesktop().browse(URI.create("https://127.0.0.1:" + securePort + "/index.html"));
} else { } else {
BrowserLauncher.openURL("http://127.0.0.1:" + port + "/index.html"); Desktop.getDesktop().browse(URI.create("http://127.0.0.1:" + port + "/index.html"));
} }
} }
catch (Exception e) { catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment