Package com.actelion.research.util
Class Platform
- java.lang.Object
-
- com.actelion.research.util.Platform
-
public class Platform extends java.lang.Object
Requires JRE 1.6
-
-
Constructor Summary
Constructors Constructor Description Platform()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
execute(java.lang.String[] programAndArgs)
Start an executable with parameters.static java.lang.Process
execute(java.lang.String program, java.lang.String... args)
Start an executable with parameters.static boolean
is64BitJRE()
static boolean
isLinux()
static boolean
isMacintosh()
static boolean
isUnix()
static boolean
isWindows()
static void
openDocument(java.lang.String doc)
Given a filename, open this file with the default applicationstatic java.lang.Process
systemExec(java.lang.String[] programAndArgs)
Wrapper for Runtime.exec() that allows different handling by platform This method fixes forking issues in Windows when starting Mercury (by default new processes do not seem to be forked correctly)
-
-
-
Method Detail
-
isWindows
public static boolean isWindows()
-
isMacintosh
public static boolean isMacintosh()
-
isLinux
public static boolean isLinux()
-
isUnix
public static boolean isUnix()
-
is64BitJRE
public static boolean is64BitJRE()
-
execute
public static java.lang.Process execute(java.lang.String program, java.lang.String... args) throws java.io.IOException
Start an executable with parameters. In non-windows environment this is searching the PATH In the windows environment @Actelion this first checks the standard locations where applications are installed usually \\actelch02\pgm. This is achieved by consulting the ApplicationDatabase.db file located under \\actelch02\pgm\ActelionResearch. The file format is a standard Java properties file where the key contains the name of the application and the value the respective absolute path of the executable e.g. datawarrior=//actelch02/pgm/Datawarrior/DataWarrior.exe- Parameters:
program
-args
-- Throws:
java.io.IOException
-
execute
public static void execute(java.lang.String[] programAndArgs) throws java.io.IOException
Start an executable with parameters. In non-windows environment this is searching the PATH In the windows environment @Actelion this first checks the standard locations where applications are installed usually \\actelch02\pgm. This is achieved by consulting the ApplicationDatabase.db file located under \\actelch02\pgm\ActelionResearch. The file format is a standard Java properties file where the key contains the name of the application and the value the respective absolute path of the executable e.g. datawarrior=//actelch02/pgm/Datawarrior/DataWarrior.exe- Parameters:
programAndArgs
-- Throws:
java.io.IOException
-
systemExec
public static java.lang.Process systemExec(java.lang.String[] programAndArgs) throws java.io.IOException
Wrapper for Runtime.exec() that allows different handling by platform This method fixes forking issues in Windows when starting Mercury (by default new processes do not seem to be forked correctly)- Parameters:
programAndArgs
-- Returns:
- Throws:
java.io.IOException
-
openDocument
public static void openDocument(java.lang.String doc) throws java.io.IOException, java.lang.UnsupportedOperationException
Given a filename, open this file with the default application- Parameters:
doc
- File name to open- Throws:
java.io.IOException
- if the file is unavailablejava.lang.UnsupportedOperationException
-
-