robertjanetzko / LegendsBrowser

Legends Browser is an multi-platform, open source, java-based legends viewer for dwarf fortress 0.42.
MIT License
63 stars 19 forks source link

Desktop.browse does not actually start a browser. #70

Closed o11c closed 3 years ago

o11c commented 3 years ago

In https://github.com/robertjanetzko/LegendsBrowser/blob/master/src/main/java/legends/Application.java

function initWebServer swallows UnsupportedOperationException from:

Desktop.getDesktop().browse(new URI("http://localhost:" + server.getPort()));

The problem is that Desktop.browse is notoriously unreliable and non-portable.

On Unix systems, the correct solution is to spawn a process, xdg-open http://localhost:58881, but for some reason nobody has ever bothered to patch that into Java itself.

At the very least, pop up a window to display the warning so we at least know, when not running from a terminal.

McArcady commented 3 years ago

Do you have more details on the context in which you saw the function fail? Optionally, are you aware of any portable alternatives we could use?