Package org.apache.uima.internal.util
Class BrowserUtil
- java.lang.Object
-
- org.apache.uima.internal.util.BrowserUtil
-
public class BrowserUtil extends java.lang.ObjectTheBrowserUtilclass provides one static method -openUrlInDefaultBrowser, which opens the given URL in the default web browser for the current user of the system. Current implementation supports Windows, Linux and some Unix systems.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String[]__browserLauncherThe command that launches system browserprivate static int__osIdThe internal ID of the OS we are running onprivate static java.lang.StringFIRST_WINDOWS_PARAMETERThe first parameter that needs to be passed into Runtime.exec() to open the default web browser on Windows.private static intMAC_OSJVM constant for MacOS JVMprivate static intOTHERJVM constant for any other platformprivate static java.lang.StringSECOND_WINDOWS_PARAMETERThe second parameter for Runtime.exec() on Windows.private static java.lang.StringTHIRD_WINDOWS_PARAMETERThe third parameter for Runtime.exec() on Windows.private static intWINDOWS_9xJVM constant for any Windows 9x JVMprivate static intWINDOWS_NTJVM constant for any Windows NT JVM
-
Constructor Summary
Constructors Modifier Constructor Description privateBrowserUtil()This class should be never be instantiated; this just ensures so.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String[] args)For testing only.static java.lang.ProcessopenUrlInDefaultBrowser(java.lang.String url)Attempts to open the default web browser to the given URL.
-
-
-
Field Detail
-
__osId
private static int __osId
The internal ID of the OS we are running on
-
__browserLauncher
private static java.lang.String[] __browserLauncher
The command that launches system browser
-
WINDOWS_NT
private static final int WINDOWS_NT
JVM constant for any Windows NT JVM- See Also:
- Constant Field Values
-
WINDOWS_9x
private static final int WINDOWS_9x
JVM constant for any Windows 9x JVM- See Also:
- Constant Field Values
-
MAC_OS
private static final int MAC_OS
JVM constant for MacOS JVM- See Also:
- Constant Field Values
-
OTHER
private static final int OTHER
JVM constant for any other platform- See Also:
- Constant Field Values
-
FIRST_WINDOWS_PARAMETER
private static final java.lang.String FIRST_WINDOWS_PARAMETER
The first parameter that needs to be passed into Runtime.exec() to open the default web browser on Windows.- See Also:
- Constant Field Values
-
SECOND_WINDOWS_PARAMETER
private static final java.lang.String SECOND_WINDOWS_PARAMETER
The second parameter for Runtime.exec() on Windows.- See Also:
- Constant Field Values
-
THIRD_WINDOWS_PARAMETER
private static final java.lang.String THIRD_WINDOWS_PARAMETER
The third parameter for Runtime.exec() on Windows. This is a "title" parameter that the command line expects. Setting this parameter allows URLs containing spaces to work.- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
For testing only.- Parameters:
args- [url_to_open]
-
openUrlInDefaultBrowser
public static java.lang.Process openUrlInDefaultBrowser(java.lang.String url) throws java.lang.ExceptionAttempts to open the default web browser to the given URL.- Parameters:
url- The URL to open- Returns:
- Returns the process browser object or null if no browser could be found. On MacOs null is returned in any case.
- Throws:
java.lang.Exception- If the available web browser does not run
-
-