java.lang.Runtime (JDK 1.0)
This class encapsulates a number of platform-dependent system functions. The static method getRuntime() returns the Runtime object for the current platform, and this object can be used to perform system functions in a platform-independent way.
exec() starts a new process running externally to the interpreter. Note that any processes run outside of Java may be system-dependent.
exit() causes the Java interpreter to exit and return a specified return code.
freeMemory() returns the approximate amount of free memory. totalMemory() returns the total amount of memory available to the Java interpreter. gc() forces the garbage collector to run synchronously, which may free up more memory. Similarly, runFinalization() forces the finalize() methods of unreferenced objects to be run immediately. This may free up system resources that those objects were holding.
load() loads a dynamic library with a fully specified path name. loadLibrary() loads a dynamic library with only the library name specified; it looks in platform-dependent locations for the specified library. These libraries generally contain native code definitions for native methods.
traceInstructions() and traceMethodCalls() enable and disable tracing by the interpreter.
Note that some of the Runtime methods are more commonly called via the static methods of the System class.
public classRuntimeextends Object { //No Constructor//Class Methodspublic static RuntimegetRuntime(); 1.1public static voidrunFinalizersOnExit(booleanvalue); //Public Instance Methodspublic Processexec(Stringcommand) throws IOException; public Processexec(Stringcommand, String[]envp) throws IOException; public Processexec(String[]cmdarray) throws IOException; public Processexec(String[]cmdarray, String[]envp) throws IOException; public voidexit(intstatus); public native longfreeMemory(); public native voidgc(); # public InputStreamgetLocalizedInputStream(InputStreamin); # public OutputStreamgetLocalizedOutputStream(OutputStreamout); public synchronized voidload(Stringfilename); public synchronized voidloadLibrary(Stringlibname); public native voidrunFinalization(); public native longtotalMemory(); public native voidtraceInstructions(booleanon); public native voidtraceMethodCalls(booleanon); }
Returned By:
Runtime.getRuntime()