Runtime class

Runtime class is the interface to the environment.

Get the instance of a runtime

ReturnMethodSummary
static RuntimegetRuntime()Returns the runtime object associated with the current Java application.

Get the memory in your Java virtual machine

ReturnMethodSummary
longtotalMemory()Returns the total amount of memory in the Java virtual machine.
longfreeMemory()Returns the amount of free memory in the Java Virtual Machine.
longmaxMemory()Returns the maximum amount of memory that the Java virtual machine will attempt to use.

Shut down hook

ReturnMethodSummary
voidaddShutdownHook(Thread hook)Registers a new virtual-machine shutdown hook.
booleanremoveShutdownHook(Thread hook)De-registers a previously-registered virtual-machine shutdown hook.

Get the available processor

ReturnMethodSummary
intavailableProcessors()Returns the number of processors available to the Java virtual machine.

Exit and halt Java virtual machine

ReturnMethodSummary
voidexit(int status)Terminates the currently running Java virtual machine by initiating its shutdown sequence.
voidhalt(int status)Terminates the currently running Java virtual machine.

Run garbage collector and finalization methods

ReturnMethodSummary
voidgc()Runs the garbage collector.
voidrunFinalization()Runs the finalization methods of any objects pending finalization.

Load Dynamic library

ReturnMethodSummary
voidload(String filename)Loads the filename as a dynamic library.
voidloadLibrary(String libname)Loads the library with the specified library name.

Trace instructions and method calls

ReturnMethodSummary
voidtraceInstructions(boolean on)Enables/Disables tracing of instructions.
voidtraceMethodCalls(boolean on)Enables/Disables tracing of method calls.

Execuate a system command

ReturnMethodSummary
Processexec(String command)Executes the specified string command in a separate process.
Processexec(String[] cmdarray)Executes the specified command and arguments in a separate process.
Processexec(String[] cmdarray, String[] envp)Executes the specified command and arguments in a separate process with the specified environment.
Processexec(String[] cmdarray, String[] envp, File dir)Executes the specified command and arguments in a separate process with the specified environment and working directory.
Processexec(String command, String[] envp)Executes the specified string command in a separate process with the specified environment.
Processexec(String command, String[] envp, File dir)Executes the specified string command in a separate process with the specified environment and working directory.
Revised from Open JDK source code
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.