mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-05 21:24:19 -04:00
Add support if desktop.browse(uri) is not supported (Ubuntu with latest java version)
This commit is contained in:
parent
107731b884
commit
b7d6c5195e
1 changed files with 15 additions and 2 deletions
|
@ -31,6 +31,8 @@ import java.io.ObjectOutputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
@ -138,9 +140,20 @@ public class Utilities {
|
||||||
printElapsedTime("");
|
printElapsedTime("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void openURI(URI uri) throws IOException {
|
||||||
|
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
|
||||||
|
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE))
|
||||||
|
desktop.browse(uri);
|
||||||
|
else
|
||||||
|
new ProcessBuilder("x-www-browser", uri.toURL().toString()).start();
|
||||||
|
}
|
||||||
|
|
||||||
public static void openURL(String url) throws Exception {
|
public static void openWebPage(String target) throws URISyntaxException, IOException {
|
||||||
Desktop.getDesktop().browse(new URI(url));
|
openURI(new URI(target));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openURL(URL url) throws URISyntaxException, IOException {
|
||||||
|
openURI(url.toURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue