java.lang.Runtime
This class, with the exception of the exec() APIs, must be implemented by the
VM vendor. The exec() APIs must first do any required security checks, and
then call org.apache.harmony.luni.internal.process.SystemProcess.create().
The Runtime interface.
Summary
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Methods
public
void
addShutdownHook(Thread hook)
Registers a new virtual-machine shutdown hook.
Parameters
hook
| the hook (a Thread) to register
|
public
int
availableProcessors()
Return the number of processors, always at least one.
Execute progArray[0] in a separate platform process. The new process uses
the environment provided in envp
Parameters
progArray
| the array containing the program to execute a well as
any arguments to the program. |
envp
| the array containing the environment to start the new process
in. |
directory
| the directory in which to execute progArray[0]. If null,
execute in same directory as parent process. |
Execute prog in a separate platform process The new process uses the
environment provided in envp
Parameters
prog
| the name of the program to execute |
envp
| the array containing the environment to start the new process
in. |
Execute program in a separate platform process The new process inherits
the environment of the caller.
Parameters
prog
| the name of the program to execute |
Execute prog in a separate platform process The new process uses the
environment provided in envp
Parameters
prog
| the name of the program to execute |
envp
| the array containing the environment to start the new process
in. |
directory
| the initial directory for the subprocess, or null to use
the directory of the current process |
Execute progArray[0] in a separate platform process The new process
inherits the environment of the caller.
Parameters
progArray
| the array containing the program to execute as well as
any arguments to the program. |
Execute progArray[0] in a separate platform process The new process uses
the environment provided in envp
Parameters
progArray
| the array containing the program to execute a well as
any arguments to the program. |
envp
| the array containing the environment to start the new process
in. |
public
void
exit(int code)
Causes the virtual machine to stop running, and the program to exit. If
runFinalizersOnExit(true) has been invoked, then all finalizers will be
run first.
public
long
freeMemory()
Returns the amount of free memory resources which are available to the
running program.
public
void
gc()
Indicates to the virtual machine that it would be a good time to collect
available memory. Note that, this is a hint only.
public
static
Runtime
getRuntime()
Return the single Runtime instance
public
void
halt(int code)
Causes the virtual machine to stop running, and the program to exit.
Finalizers will not be run first. Shutdown hooks will not be run.
public
void
load(String pathName)
Loads and links the library specified by the argument.
Parameters
pathName
| the absolute (ie: platform dependent) path to the library
to load |
public
void
loadLibrary(String libName)
Loads and links the library specified by the argument.
Parameters
libName
| the name of the library to load |
public
long
maxMemory()
Return the maximum memory that will be used by the virtual machine, or
Long.MAX_VALUE.
public
boolean
removeShutdownHook(Thread hook)
De-registers a previously-registered virtual-machine shutdown hook.
Parameters
hook
| the hook (a Thread) to de-register |
Returns
- true if the hook could be de-registered
public
void
runFinalization()
Provides a hint to the virtual machine that it would be useful to attempt
to perform any outstanding object finalizations.
public
static
void
runFinalizersOnExit(boolean run)
This method is deprecated.
This method is unsafe.
Ensure that, when the virtual machine is about to exit, all objects are
finalized. Note that all finalization which occurs when the system is
exiting is performed after all running threads have been terminated.
Parameters
run
| true means finalize all on exit. |
public
long
totalMemory()
Returns the total amount of memory resources which is available to (or in
use by) the running program.
public
void
traceInstructions(boolean enable)
Turns the output of debug information for instructions on or off.
Parameters
enable
| if true, turn trace on. false turns trace off.
|
public
void
traceMethodCalls(boolean enable)
Turns the output of debug information for methods on or off.
Parameters
enable
| if true, turn trace on. false turns trace off.
|