Runtime

Name

Runtime

Synopsis

Description

The Runtime class provides access to various information about the environment in which a program is running. The Java run-time environment creates a single instance of this class that is associated with a program. The Runtime class does not have any public constructors, so a program cannot create its own instances of the class. A program must call the getRuntime() method to get a reference to the current Runtime object.

Information about operating system features is accessible through the System class.

Class Summary

public class java.lang.Runtime extends java.lang.Object {
 // Class Methods public static Runtime getRuntime();
public static void runFinalizersOnExit(boolean value); // New in 1.1 // Instance Methods public Process exec(String command);
public Process exec(String command, String envp[]);
public Process exec(String cmdarray[]);
public Process exec(String cmdarray[], String envp[]);
public void exit(int status);
public native long freeMemory();
public native void gc();
public InputStream getLocalizedInputStream(InputStream in); // Deprecated in 1.1 public OutputStream getLocalizedOutputStream(OutputStream out); // Deprecated in 1.1 public synchronized void load(String filename);
public synchronized void loadLibrary(String libname);
public native void runFinalization();
public native long totalMemory();
public native void traceInstructions(boolean on);
public native void traceMethodCalls(boolean on);
}

Class Methods

getRuntime

public static Runtime getRuntime()

runFinalizersOnExit

public static void runFinalizersOnExit(boolean value)

Instance Methods

exec

public Process exec(String command) throws IOException

public Process exec(String command, String[] envp) throws IOException 

public Process exec(String[] commandArray) throws IOException 

public Process exec(String[] commandArray, String[] envp) throws IOException 

exit

public void exit(int status)

freeMemory

public native long freeMemory()

gc

public native void gc()

getLocalizedInputStream

public InputStream getLocalizedInputStream(InputStream in)

getLocalizedOutputStream

public OutputStream getLocalizedOutputStream(OutputStream out)

load

public synchronized void load(String filename)

loadLibrary

public synchronized void loadLibrary(String libname)

runFinalization

public native void runFinalization()

totalMemory

public native long totalMemory()

traceInstructions

public native void traceInstructions(boolean on)

traceMethodCalls

public native void traceMethodCalls(boolean on)

Inherited Methods

Method Inherited From Method Inherited From
clone() Object equals(Object) Object
finalize() Object getClass() Object
hashCode() Object notify() Object
notifyAll() Object toString() Object
wait() Object wait(long) Object
wait(long, int) Object

See Also

Errors; Exceptions; Object; Object Destruction; Process; SecurityManager; System