Package org.apache.uima.internal.util
Class BrowserUtil
java.lang.Object
org.apache.uima.internal.util.BrowserUtil
The
BrowserUtil
class 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
FieldsModifier and TypeFieldDescriptionprivate static String[]
The command that launches system browserprivate static int
The internal ID of the OS we are running onprivate static final String
The first parameter that needs to be passed into Runtime.exec() to open the default web browser on Windows.private static final int
JVM constant for MacOS JVMprivate static final int
JVM constant for any other platformprivate static final String
The second parameter for Runtime.exec() on Windows.private static final String
The third parameter for Runtime.exec() on Windows.private static final int
JVM constant for any Windows 9x JVMprivate static final int
JVM constant for any Windows NT JVM -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
This class should be never be instantiated; this just ensures so. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
For testing only.static Process
Attempts to open the default web browser to the given URL.
-
Field Details
-
__osId
private static int __osIdThe internal ID of the OS we are running on -
__browserLauncher
The command that launches system browser -
WINDOWS_NT
private static final int WINDOWS_NTJVM constant for any Windows NT JVM- See Also:
-
WINDOWS_9x
private static final int WINDOWS_9xJVM constant for any Windows 9x JVM- See Also:
-
MAC_OS
private static final int MAC_OSJVM constant for MacOS JVM- See Also:
-
OTHER
private static final int OTHERJVM constant for any other platform- See Also:
-
FIRST_WINDOWS_PARAMETER
The first parameter that needs to be passed into Runtime.exec() to open the default web browser on Windows.- See Also:
-
SECOND_WINDOWS_PARAMETER
The second parameter for Runtime.exec() on Windows.- See Also:
-
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:
-
-
Constructor Details
-
BrowserUtil
private BrowserUtil()This class should be never be instantiated; this just ensures so.
-
-
Method Details
-
main
For testing only.- Parameters:
args
- [url_to_open]
-
openUrlInDefaultBrowser
Attempts 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:
Exception
- If the available web browser does not run
-