java.lang.Objectcom.install4j.api.Util
public class Util
The class contains various utility functions to be used by script properties, custom actions and custom screens.
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static void |
dumpVariables(Context context)
Dump all defined installer variables to stderr. |
static void |
fatalError(java.lang.Throwable t)
This method can be invoked if you encounter a non-recoverable and non-expected error in your custom code. |
static java.lang.String |
getAnnotatedStackTrace(java.lang.Throwable t)
If a stack trace comes from scripts, it can be difficult to trace them to their origin by looking at the stack trace alone. |
static java.awt.Window |
getParentWindow()
Get the window of the installer. |
static java.lang.String |
getStandardApplicationsDirectory()
Returns the standard directory for installing applications. |
static java.lang.String |
getUserHome()
Returns the home directory. |
static boolean |
is64BitWindows()
Returns whether the Windows is a 64-bit Windows, regardless of whether the installer is running with a 32-bit JVM or a 64-bit JVM. |
static boolean |
isAdminUser()
Checks whether the current user has administration privileges. |
static boolean |
isAix()
Returns whether the platform is AIX. |
static boolean |
isAtLeastWindowsVista()
Returns whether the platform is at least Windows Vista. |
static boolean |
isHpux()
Returns whether the platform is HP UX. |
static boolean |
isLinux()
Returns whether the platform is Linux. |
static boolean |
isMacOS()
Returns whether the platform is Mac OS X. |
static boolean |
isMacosInstaller()
Returns whether the installer is a Mac OS X installer |
static boolean |
isSolaris()
Returns whether the platform is Solaris. |
static boolean |
isUnixInstaller()
Returns whether the installer is a Unix installer |
static boolean |
isWindows()
Returns whether the platform is Windows. |
static boolean |
isWindows2000()
Returns whether the platform is Windows 2000. |
static boolean |
isWindows2003()
Returns whether the platform is Windows 2003. |
static boolean |
isWindows2008()
Returns whether the platform is Windows 2008. |
static boolean |
isWindows7()
Returns whether the platform is Windows 7. |
static boolean |
isWindows9X()
Returns whether the platform is Windows 9X (95, 98, ME). |
static boolean |
isWindowsInstaller()
Returns whether the installer is a Windows installer |
static boolean |
isWindowsNT()
Returns whether the platform is Windows NT (not Windows 2000 and XP). |
static boolean |
isWindowsVista()
Returns whether the platform is Windows Vista. |
static boolean |
isWindowsXP()
Returns whether the platform is Windows XP. |
static void |
logError(java.lang.Object source,
java.lang.String message)
Writes an error message to the installation log. |
static void |
logInfo(java.lang.Object source,
java.lang.String message)
Writes an info message to the installation log. |
static void |
printAnnotatedStackTrace(java.lang.Throwable t)
Prints the return value of getAnnotatedStackTrace(Throwable) to System.err. |
static void |
showErrorMessage(java.lang.String message)
Show a message dialog. |
static void |
showMessage(java.lang.String message)
Show a message dialog. |
static void |
showMessage(java.lang.String message,
int messageType)
Show a message dialog. |
static int |
showOptionDialog(java.lang.String message,
java.lang.String[] options,
int messageType)
Show an options dialog. |
static void |
showPath(java.lang.String path)
Show the specified directory or file. |
static void |
showUrl(java.net.URL url)
Show a URL in the default browser. |
static void |
showWarningMessage(java.lang.String message)
Show a message dialog. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static java.lang.String getUserHome()
public static boolean isSolaris()
public static boolean isLinux()
public static boolean isWindows()
public static boolean isWindows9X()
public static boolean isWindowsNT()
public static boolean isAtLeastWindowsVista()
public static boolean isWindowsVista()
public static boolean isWindows7()
public static boolean isWindowsXP()
public static boolean isWindows2000()
public static boolean isWindows2003()
public static boolean isWindows2008()
public static boolean is64BitWindows()
This method inspects the environment variables PROCESSOR_ARCHITECTURE and PROCESSOR_ARCHITEW6432. If PROCESSOR_ARCHITECTURE contains AMD64 or IA64, the currently used JRE is a 64-bit JRE which is then by definition running on a 64-bit Windows. If PROCESSOR_ARCHITECTURE contains x86, the PROCESSOR_ARCHITEW6432 is undefined for a 32-bit Windows and contains AMD64 or IA64 for a 64-bit Windows.
public static boolean isMacOS()
public static boolean isHpux()
public static boolean isAix()
public static boolean isWindowsInstaller()
public static boolean isUnixInstaller()
public static boolean isMacosInstaller()
public static java.lang.String getStandardApplicationsDirectory()
public static void showUrl(java.net.URL url)
For quiet installers, this method does nothing.
url
- the URL to be shown in the browser.public static void showMessage(java.lang.String message, int messageType)
message
- the messagemessageType
- the message type (see JOptionPane)JOptionPane
public static void showMessage(java.lang.String message)
message
- the messageJOptionPane
public static void showErrorMessage(java.lang.String message)
message
- the messageJOptionPane
public static void showWarningMessage(java.lang.String message)
message
- the messageJOptionPane
public static int showOptionDialog(java.lang.String message, java.lang.String[] options, int messageType) throws UserCanceledException
message
- the messageoptions
- the optionsmessageType
- the message type (see JOptionPane)
UserCanceledException
- if the user cancels the selectionJOptionPane
public static void fatalError(java.lang.Throwable t)
t
- the exception that ocurredpublic static java.awt.Window getParentWindow()
public static void logInfo(java.lang.Object source, java.lang.String message)
source
- the object that requests the log. Can be null.message
- the message to be logged.public static void logError(java.lang.Object source, java.lang.String message)
source
- the object that requests the log. Can be null.message
- the message to be logged.public static void dumpVariables(Context context)
context
- the contextpublic static boolean isAdminUser()
public static java.lang.String getAnnotatedStackTrace(java.lang.Throwable t)
t
- the exception
public static void printAnnotatedStackTrace(java.lang.Throwable t)
getAnnotatedStackTrace(Throwable)
to System.err.
This can be used for debugging purposes.
t
- the exceptionpublic static void showPath(java.lang.String path)
path
- the directory that should be displayed