Public Sub ShowURI(Address As String)
Dim Desktop As JavaObject
Desktop.InitializeStatic("java.awt.Desktop")
Desktop = Desktop.RunMethod("getDesktop",Null)
Dim supported As Boolean = Desktop.RunMethod("isSupported", Array("BROWSE"))
If supported Then
Dim URI As JavaObject
URI.InitializeNewInstance("java.net.URI",Array(Address))
Desktop.RunMethod("browse",Array(URI))
End If
End Sub
Public Sub ShowURILinux(Address As String)
' Dim shl As Shell
' shl.InitializeDoNotHandleQuotes("shl", "xdg-open", Array As String (Address))
' shl.Run(-1)
'---------------------------------------------------------------------
' Run_Command("xdg-open", Array As String (Address))
'---------------------------------------------------------------------
' ShowURI(Address)
'---------------------------------------------------------------------
'Dim jo As JavaObject
'jo.InitializeStatic("java.lang.Runtime")
'jo.RunMethodJO("getRuntime", Null).RunMethod("exec", Array("xdg-open " & Address))
'jo.RunMethodJO("getRuntime", Null).RunMethod("exec", Array("x-www-browser " & Address))
'---------------------------------------------------------------------
' Run_Command("x-www-browser", Array As String ("--no-sandbox", Address))
'---------------------------------------------------------------------
Dim bash_script As String = $"
if which firefox > /dev/null; then
firefox "%Address%" || { echo "firefox: error opening URL"; Exit 1; }
elif which xdg-open > /dev/null; then
xdg-open "%Address%" || { echo "xdg-open: error opening URL"; Exit 1; }
elif which gnome-open > /dev/null; then
x-www-browser --no-sandbox "%Address%" || { echo "x-www-browser: error opening URL"; Exit 1; }
elif which x-www-browser > /dev/null; then
gnome-open "%Address%" || { echo "gnome-open: error opening URL"; Exit 1; }
Else
echo "No web-browser for opening URL."
fi
"$
bash_script = bash_script.Replace("%Address%", Address)
File.WriteString(WorkingDir, "1.sh", bash_script)
Run_Command("bash", Array As String ("1.sh"))
End Sub