public class RunTime extends Object
Modifier and Type | Class and Description |
---|---|
class |
RunTime.oneFileFilter |
static class |
RunTime.Type |
Modifier and Type | Method and Description |
---|---|
boolean |
addToClasspath(String jarOrFolder)
adds the given folder or jar to the end of the current classpath
|
File |
asExtension(String fpJar) |
static int |
checkArgs(String[] args,
RunTime.Type typ) |
static String |
delOpt(Properties props,
String pName) |
static boolean |
delOpts(Properties props) |
void |
dumpClassPath()
print the current classpath entries to sysout
|
void |
dumpClassPath(String filter)
print the current classpath entries to sysout whose path name contain the given string
|
void |
dumpOptions()
all options and their values written to sysout as key = value
|
void |
dumpSysProps()
print the current java system properties key-value pairs sorted by key
|
void |
dumpSysProps(String filter)
print the current java system properties key-value pairs sorted by key but only keys containing filter
|
List<String> |
extractResourcesToFolder(String fpRessources,
File fFolder,
FilenameFilter filter)
export all resource files from the given subtree on classpath to the given folder retaining the subtree
to export a specific file from classpath use extractResourceToFile or extractResourceToString |
List<String> |
extractResourcesToFolderFromJar(String aJar,
String fpRessources,
File fFolder,
FilenameFilter filter)
export all resource files from the given subtree in given jar to the given folder retaining the subtree
|
boolean |
extractResourceToFile(String inPrefix,
String inFile,
File outDir)
store a resource found on classpath to a file in the given folder with same filename
|
boolean |
extractResourceToFile(String inPrefix,
String inFile,
File outDir,
String outFile)
store a resource found on classpath to a file in the given folder
|
String |
extractResourceToString(String inPrefix,
String inFile,
String encoding)
store the content of a resource found on classpath in the returned string
|
URL |
fromClasspath(String artefact) |
static RunTime |
get()
get the initialized RunTime singleton instance
|
static RunTime |
get(RunTime.Type typ) |
static RunTime |
get(RunTime.Type typ,
String[] clArgs)
INTERNAL USE to initialize the runtime environment for SikuliX
for public use: use RunTime.get() to get the existing instance |
Rectangle |
getAllMonitors() |
String[] |
getArgs() |
GraphicsDevice |
getGraphicsDevice(int id) |
String |
getLastCommandResult() |
Rectangle |
getMonitor(int n) |
static String |
getOpt(Properties props,
String pName) |
static String |
getOpt(Properties props,
String pName,
String deflt) |
String |
getOption(String pName)
look into the option file if any (if no option file is found, the option is taken as not existing)
|
String |
getOption(String pName,
String sDefault)
look into the option file if any (if no option file is found, the option is taken as not existing)
side-effect: if no options file is there, an options store will be created in memory in this case and when the option is absent or empty, the given default will be stored you might later save the options store to a file with storeOptions() |
int |
getOptionNumber(String pName)
CONVENIENCE: look into the option file if any (if no option file is found, the option is taken as not existing)
tries to convert the stored string value into an integer number (gives 0 if not possible) |
int |
getOptionNumber(String pName,
Integer nDefault)
CONVENIENCE: look into the option file if any (if no option file is found, the option is taken as not existing)
tries to convert the stored string value into an integer number (gives 0 if not possible) |
Map<String,String> |
getOptions()
all options and their values
|
static double |
getOptNum(Properties props,
String pName) |
static double |
getOptNum(Properties props,
String pName,
double deflt) |
static Map<String,String> |
getOpts(Properties props) |
String[] |
getSikuliArgs() |
void |
getStatus() |
String |
getSystemInfo() |
String |
getVersion() |
String |
getVersionShort() |
String |
getVersionShortBasic() |
static boolean |
hasOpt(Properties props,
String pName) |
boolean |
hasOptions()
check whether options are defined
|
static int |
hasOpts(Properties props) |
Rectangle |
hasPoint(Point aPoint) |
Rectangle |
hasRectangle(Rectangle aRect) |
boolean |
isHeadless()
checks, whether Java runs with a valid GraphicsEnvironment (usually means real screens connected)
|
String |
isJarOnClasspath(String artefact) |
boolean |
isJava7() |
boolean |
isJava8() |
boolean |
isMultiMonitor() |
String |
isOnClasspath(String artefact) |
boolean |
isOnClasspath(URL path)
check wether a the given URL is on classpath
|
boolean |
isOption(String pName)
CONVENIENCE: look into the option file if any (if no option file is found, the option is taken as not existing)
|
boolean |
isOption(String pName,
Boolean bDefault)
CONVENIENCE: look into the option file if any (if no option file is found, the option is taken as not existing)
|
boolean |
isOSX10() |
boolean |
isRunningFromJar()
INTERNAL USE: to check whether we are running in compiled classes context
|
boolean |
isVersionRelease() |
static void |
loadLibrary(String libname)
INTERNAL USE: load a native library from the libs folder
|
static boolean |
loadLibrary(String libname,
boolean useLibsProvided)
INTERNAL USE: load a native library from the libs folder
|
Properties |
loadOpts(String fpOptions)
load a properties file
|
void |
makeFolders() |
static Properties |
makeOpts() |
boolean |
needsRobotFake() |
static void |
pause(float time) |
static void |
pause(int time) |
void |
printArgs() |
static RunTime |
reset()
INTERNAL USE get a new initialized RunTime singleton instance
|
static RunTime |
reset(RunTime.Type typ)
INTERNAL USE get a new initialized RunTime singleton instance
|
static void |
resetProject() |
String[] |
resourceListAsFile(String folder,
File target,
FilenameFilter filter)
write the list as it is produced by calling extractResourcesToFolder to the given file with system line
separator
non-compact format: every file with full path |
String[] |
resourceListAsSikulixContent(String folder,
File targetFolder,
FilenameFilter filter)
write the list as it is produced by calling extractResourcesToFolder to the given file with system line
separator
compact sikulixcontent format |
String[] |
resourceListAsSikulixContentFromJar(String aJar,
String folder,
File targetFolder,
FilenameFilter filter)
write the list as it is produced by calling extractResourcesToFolder to the given file with system line
separator
compact sikulixcontent format |
String |
resourceListAsString(String folder,
FilenameFilter filter)
write the list produced by calling extractResourcesToFolder to the returned string with system line separator
non-compact format: every file with full path |
String |
resourceListAsString(String folder,
FilenameFilter filter,
String separator)
write the list produced by calling extractResourcesToFolder to the returned string with given separator
non-compact format: every file with full path |
URL |
resourceLocation(String folderOrFile) |
String |
runcmd(String cmd)
run a system command finally using Java::Runtime.getRuntime().exec(args) and waiting for completion
|
String |
runcmd(String[] args)
run a system command finally using Java::Runtime.getRuntime().exec(args) and waiting for completion
|
boolean |
saveOpts(Properties pOptions)
save a properties store to a file (prop: this.comingfrom = abs.
|
boolean |
saveOpts(Properties pOptions,
String fpOptions)
save a properties store to the given file
|
void |
setArgs(String[] args,
String[] sargs) |
static String |
setOpt(Properties props,
String pName,
String pVal) |
void |
setOption(String pName,
String sValue)
store an option key-value pair, overwrites existing value
new option store is created if necessary and can later be saved to a file |
static double |
setOptNum(Properties props,
String pName,
double pVal) |
static int |
setOpts(Properties props,
Map<String,String> aMap) |
void |
show()
print out some basic information about the current runtime environment
|
void |
terminate(int retval,
String message,
Object... args) |
boolean |
testSwitch() |
public static File scriptProject
public static URL uScriptProject
public static boolean shouldRunServer
public static String appDataMsg
public static final String runCmdError
public static String NL
public boolean runningInteractive
public boolean runningTests
public String interactiveRunner
public File fLibsProvided
public File fLibsLocal
public boolean useLibsProvided
public boolean shouldCleanDownloads
public boolean isJythonReady
public static boolean testing
public static boolean testingWinApp
public RunTime.Type runType
public String sxBuild
public String sxBuildStamp
public String jreVersion
public Preferences optionsIDE
public ClassLoader classLoader
public String baseJar
public String userName
public String fpBaseTempPath
public File fTempPath
public File fBaseTempPath
public File fLibsFolder
public String fpJarLibs
public String fpSysLibs
public File fUserDir
public File fWorkDir
public File fTestFolder
public File fTestFile
public File fAppPath
public File fSikulixAppPath
public File fSikulixExtensions
public String[] standardExtensions
public File fSikulixLib
public File fSikulixStore
public File fSikulixDownloadsGeneric
public File fSikulixDownloadsBuild
public File fSikulixSetup
public File fSxBase
public File fSxBaseJar
public File fSxProject
public File fSxProjectTestScriptsJS
public File fSxProjectTestScripts
public String fpContent
public boolean runningJar
public boolean runningInProject
public boolean runningWindows
public boolean runningMac
public boolean runningLinux
public boolean runningWinApp
public boolean runningMacApp
public String javaShow
public int javaArch
public int javaVersion
public String javahome
public String osName
public String sysName
public String osVersion
public int debuglevelAPI
public String linuxDistro
public String linuxNeededLibs
public Rectangle[] monitorBounds
public int SikuliVersionMajor
public int SikuliVersionMinor
public int SikuliVersionSub
public int SikuliVersionBetaN
public String SikuliProjectVersionUsed
public String SikuliProjectVersion
public String SikuliVersionBuild
public String SikuliVersionType
public String SikuliVersionTypeText
public String downloadBaseDirBase
public String downloadBaseDirWeb
public String downloadBaseDir
public String SikuliRepo
public String SikuliLocalRepo
public String[] ServerList
public String SikuliVersionDefault
public String SikuliVersionBeta
public String SikuliVersionDefaultIDE
public String SikuliVersionBetaIDE
public String SikuliVersionDefaultScript
public String SikuliVersionBetaScript
public String SikuliVersion
public String SikuliVersionIDE
public String SikuliVersionScript
public String SikuliJythonVersion
public String SikuliJythonVersion25
public String SikuliJythonMaven
public String SikuliJythonMaven25
public String SikuliJython
public String SikuliJython25
public String SikuliJRubyVersion
public String SikuliJRuby
public String SikuliJRubyMaven
public String dlMavenRelease
public String dlMavenSnapshot
public final String libOpenCV
public String SikuliVersionLong
public String SikuliSystemVersion
public String SikuliJavaVersion
public static void resetProject()
public static void pause(int time)
public static void pause(float time)
public static RunTime get(RunTime.Type typ)
public static RunTime get(RunTime.Type typ, String[] clArgs)
typ
- IDE or APIpublic static RunTime get()
public static RunTime reset(RunTime.Type typ)
public static RunTime reset()
public void makeFolders()
public static void loadLibrary(String libname)
libname
- name of library without prefix/suffix/endingpublic static boolean loadLibrary(String libname, boolean useLibsProvided)
libname
- name of library without prefix/suffix/endingpublic boolean isRunningFromJar()
public boolean isJava8()
public boolean isJava7()
public boolean isOSX10()
public boolean needsRobotFake()
public void show()
public boolean testSwitch()
public String getVersionShortBasic()
public String getVersionShort()
public String getSystemInfo()
public boolean isVersionRelease()
public String getVersion()
public void getStatus()
public boolean isOption(String pName)
pName
- the option key (case-sensitive)public boolean isOption(String pName, Boolean bDefault)
pName
- the option key (case-sensitive)bDefault
- the default to be returned if option absent or emptypublic String getOption(String pName)
pName
- the option key (case-sensitive)public String getOption(String pName, String sDefault)
pName
- the option key (case-sensitive)sDefault
- the default to be returned if option absent or emptypublic void setOption(String pName, String sValue)
pName
- sValue
- public int getOptionNumber(String pName)
pName
- the option key (case-sensitive)public int getOptionNumber(String pName, Integer nDefault)
pName
- the option key (case-sensitive)nDefault
- the default to be returned if option absent, empty or not convertablepublic Map<String,String> getOptions()
public boolean hasOptions()
public void dumpOptions()
public Properties loadOpts(String fpOptions)
fpOptions
- path to a file containing optionspublic static Properties makeOpts()
public boolean saveOpts(Properties pOptions)
pOptions
- the prop storepublic boolean saveOpts(Properties pOptions, String fpOptions)
pOptions
- the prop storefpOptions
- path to a filepublic static boolean hasOpt(Properties props, String pName)
public static String getOpt(Properties props, String pName)
public static String getOpt(Properties props, String pName, String deflt)
public static String setOpt(Properties props, String pName, String pVal)
public static double getOptNum(Properties props, String pName)
public static double getOptNum(Properties props, String pName, double deflt)
public static double setOptNum(Properties props, String pName, double pVal)
public static String delOpt(Properties props, String pName)
public static Map<String,String> getOpts(Properties props)
public static int setOpts(Properties props, Map<String,String> aMap)
public static boolean delOpts(Properties props)
public static int hasOpts(Properties props)
public List<String> extractResourcesToFolder(String fpRessources, File fFolder, FilenameFilter filter)
fpRessources
- path of the subtree relative to rootfFolder
- folder where to export (if null, only list - no export)filter
- implementation of interface FilenameFilter or null for no filteringpublic List<String> extractResourcesToFolderFromJar(String aJar, String fpRessources, File fFolder, FilenameFilter filter)
aJar
- absolute path to an existing jar or a string identifying the jar on classpath (no leading /)fpRessources
- path of the subtree or file relative to rootfFolder
- folder where to export (if null, only list - no export)filter
- implementation of interface FilenameFilter or null for no filteringpublic boolean extractResourceToFile(String inPrefix, String inFile, File outDir)
inPrefix
- a subtree found in classpathinFile
- the filename combined with the prefix on classpathoutDir
- a folder where to exportpublic boolean extractResourceToFile(String inPrefix, String inFile, File outDir, String outFile)
inPrefix
- a subtree found in classpathinFile
- the filename combined with the prefix on classpathoutDir
- a folder where to exportoutFile
- the filename for exportpublic String extractResourceToString(String inPrefix, String inFile, String encoding)
inPrefix
- a subtree from root found in classpath (leading /)inFile
- the filename combined with the prefix on classpathencoding
- public String[] resourceListAsFile(String folder, File target, FilenameFilter filter)
folder
- path of the subtree relative to root with leading /target
- the file to write the list (if null, only list - no file)filter
- implementation of interface FilenameFilter or null for no filteringpublic String[] resourceListAsSikulixContent(String folder, File targetFolder, FilenameFilter filter)
folder
- path of the subtree relative to root with leading /targetFolder
- the folder where to store the file sikulixcontent (if null, only list - no export)filter
- implementation of interface FilenameFilter or null for no filteringpublic String[] resourceListAsSikulixContentFromJar(String aJar, String folder, File targetFolder, FilenameFilter filter)
aJar
- absolute path to an existing jar or a string identifying the jar on classpath (no leading /)folder
- path of the subtree relative to root with leading /targetFolder
- the folder where to store the file sikulixcontent (if null, only list - no export)filter
- implementation of interface FilenameFilter or null for no filteringpublic String resourceListAsString(String folder, FilenameFilter filter)
folder
- path of the subtree relative to root with leading /filter
- implementation of interface FilenameFilter or null for no filteringpublic String resourceListAsString(String folder, FilenameFilter filter, String separator)
folder
- path of the subtree relative to root with leading /filter
- implementation of interface FilenameFilter or null for no filteringseparator
- to be used to separate the entriespublic void dumpClassPath()
public void dumpClassPath(String filter)
filter
- the fileter stringpublic boolean isOnClasspath(URL path)
path
- URL to look forpublic boolean addToClasspath(String jarOrFolder)
jarOrFolder
- absolute path to a folder or jarpublic void dumpSysProps()
public void dumpSysProps(String filter)
filter
- the filter stringpublic boolean isHeadless()
public boolean isMultiMonitor()
public Rectangle getMonitor(int n)
public Rectangle getAllMonitors()
public GraphicsDevice getGraphicsDevice(int id)
public String runcmd(String cmd)
cmd
- the command as it would be given on command line, quoting is preservedpublic String runcmd(String[] args)
args
- the command as it would be given on command line splitted into the space devided parts, first part is
the command, the rest are parameters and their valuespublic String getLastCommandResult()
public String[] getSikuliArgs()
public String[] getArgs()
public void printArgs()
public static int checkArgs(String[] args, RunTime.Type typ)
Copyright © 2017. All rights reserved.