public void openUrl(String pUrl) {
this.openUrl(new URL(pUrl));
}
public void openUrl(URL pUrl) {
try {
Process process = AccessController.doPrivileged((PrivilegedExceptionAction<Process>)
() -> Runtime.getRuntime().exec(this.getOpenUrlArguments(pUrl)));
process.getInputStream().close();
process.getErrorStream().close();
process.getOutputStream().close();
} catch (Exception e) {
e.printStackTrace();
}
}
private String[] getOpenUrlArguments(URL pUrl) {
return new String[]{"xdg-open", pUrl.toString()};
}