Runtime class is the interface to the environment.
Get the instance of a runtime
Return | Method | Summary |
---|---|---|
static Runtime | getRuntime() | Returns the runtime object associated with the current Java application. |
Get the memory in your Java virtual machine
Return | Method | Summary |
---|---|---|
long | totalMemory() | Returns the total amount of memory in the Java virtual machine. |
long | freeMemory() | Returns the amount of free memory in the Java Virtual Machine. |
long | maxMemory() | Returns the maximum amount of memory that the Java virtual machine will attempt to use. |
Shut down hook
Return | Method | Summary |
---|---|---|
void | addShutdownHook(Thread hook) | Registers a new virtual-machine shutdown hook. |
boolean | removeShutdownHook(Thread hook) | De-registers a previously-registered virtual-machine shutdown hook. |
Get the available processor
Return | Method | Summary |
---|---|---|
int | availableProcessors() | Returns the number of processors available to the Java virtual machine. |
Exit and halt Java virtual machine
Return | Method | Summary |
---|---|---|
void | exit(int status) | Terminates the currently running Java virtual machine by initiating its shutdown sequence. |
void | halt(int status) | Terminates the currently running Java virtual machine. |
Run garbage collector and finalization methods
Return | Method | Summary |
---|---|---|
void | gc() | Runs the garbage collector. |
void | runFinalization() | Runs the finalization methods of any objects pending finalization. |
Load Dynamic library
Return | Method | Summary |
---|---|---|
void | load(String filename) | Loads the filename as a dynamic library. |
void | loadLibrary(String libname) | Loads the library with the specified library name. |
Trace instructions and method calls
Return | Method | Summary |
---|---|---|
void | traceInstructions(boolean on) | Enables/Disables tracing of instructions. |
void | traceMethodCalls(boolean on) | Enables/Disables tracing of method calls. |
Execuate a system command
Return | Method | Summary |
---|---|---|
Process | exec(String command) | Executes the specified string command in a separate process. |
Process | exec(String[] cmdarray) | Executes the specified command and arguments in a separate process. |
Process | exec(String[] cmdarray, String[] envp) | Executes the specified command and arguments in a separate process with the specified environment. |
Process | exec(String[] cmdarray, String[] envp, File dir) | Executes the specified command and arguments in a separate process with the specified environment and working directory. |
Process | exec(String command, String[] envp) | Executes the specified string command in a separate process with the specified environment. |
Process | exec(String command, String[] envp, File dir) | Executes the specified string command in a separate process with the specified environment and working directory. |
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |