java.lang
Class Runtime

java.lang.Object
  |
  +--java.lang.Runtime

public class Runtime
extends Object

Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running. The current runtime can be obtained from the getRuntime method.

Some of the code as well as javadoc in this class was stolen from:

@(#)Runtime.java	1.62 01/12/03

 Copyright 2002 Sun Microsystems, Inc. All rights reserved.
 SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
Therefore, credit is given to the original author.

An application cannot create its own instance of this class.

Since:
JDK1.0
Version:
1.62, 12/03/01
Author:
unascribed
, Matt Murphy (the theif)
See Also:
getRuntime(), NewRuntime

Field Summary
private static Runtime currentRuntime
           
 
Constructor Summary
private Runtime()
          Don't let anyone else instantiate this class
 
Method Summary
 void addShutdownHook(Thread hook)
           
 int availableProcessors()
           
private static boolean calledFromOldRuntime()
           
 Process exec(String command)
           
 Process exec(String[] cmdarray)
           
 Process exec(String[] cmdarray, String[] envp)
           
private  Process exec(String[] cmdarray, String[] envp, boolean cfor)
           
 Process exec(String[] cmdarray, String[] envp, java.io.File dir)
           
private  Process exec(String[] cmdarray, String[] envp, java.io.File dir, boolean cfor)
           
 Process exec(String cmd, String[] envp)
           
private  Process exec(String cmd, String[] envp, boolean cfor)
           
 Process exec(String command, String[] envp, java.io.File dir)
           
private  Process exec(String command, String[] envp, java.io.File dir, boolean cfor)
           
private  Process execInternal(String[] cmdarray, String[] envp, String path)
           
 void exit(int status)
           
 long freeMemory()
           
 void gc()
           
 java.io.InputStream getLocalizedInputStream(java.io.InputStream in)
           
 java.io.OutputStream getLocalizedOutputStream(java.io.OutputStream out)
           
static Runtime getRuntime()
           
 void halt(int status)
           
 void load(String filename)
           
(package private)  void load0(Class fromClass, String filename)
           
 void loadLibrary(String libname)
           
(package private)  void loadLibrary0(Class fromClass, String libname)
           
 long maxMemory()
           
 boolean removeShutdownHook(Thread hook)
           
 void runFinalization()
           
private static void runFinalization0()
           
static void runFinalizersOnExit(boolean value)
           
 long totalMemory()
           
 void traceInstructions(boolean on)
           
 void traceMethodCalls(boolean on)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentRuntime

private static Runtime currentRuntime
Constructor Detail

Runtime

private Runtime()
Don't let anyone else instantiate this class

Method Detail

getRuntime

public static Runtime getRuntime()
See Also:
NewRuntime.getRuntime()

exit

public void exit(int status)
See Also:
NewRuntime.exit(int)

addShutdownHook

public void addShutdownHook(Thread hook)
See Also:
OldRuntime.addShutdownHook(Thread)

removeShutdownHook

public boolean removeShutdownHook(Thread hook)
See Also:
OldRuntime.removeShutdownHook(Thread)

halt

public void halt(int status)
See Also:
OldRuntime.halt(int)

runFinalizersOnExit

public static void runFinalizersOnExit(boolean value)
See Also:
OldRuntime.runFinalizersOnExit(boolean)

execInternal

private Process execInternal(String[] cmdarray,
                             String[] envp,
                             String path)
                      throws java.io.IOException
java.io.IOException

exec

public Process exec(String command)
             throws java.io.IOException
java.io.IOException
See Also:
OldRuntime.exec(String)

exec

public Process exec(String cmd,
                    String[] envp)
             throws java.io.IOException
java.io.IOException
See Also:
OldRuntime.exec(String,String[])

exec

private Process exec(String cmd,
                     String[] envp,
                     boolean cfor)
              throws java.io.IOException
java.io.IOException

exec

public Process exec(String command,
                    String[] envp,
                    java.io.File dir)
             throws java.io.IOException
java.io.IOException
See Also:
OldRuntime.exec(String,String[],File)

exec

private Process exec(String command,
                     String[] envp,
                     java.io.File dir,
                     boolean cfor)
              throws java.io.IOException
java.io.IOException

exec

public Process exec(String[] cmdarray)
             throws java.io.IOException
java.io.IOException
See Also:
OldRuntime.exec(String[])

exec

public Process exec(String[] cmdarray,
                    String[] envp)
             throws java.io.IOException
java.io.IOException
See Also:
OldRuntime.exec(String[],String[])

exec

private Process exec(String[] cmdarray,
                     String[] envp,
                     boolean cfor)
              throws java.io.IOException
java.io.IOException

exec

public Process exec(String[] cmdarray,
                    String[] envp,
                    java.io.File dir)
             throws java.io.IOException
java.io.IOException
See Also:
OldRuntime.exec(String[],String[],File)

exec

private Process exec(String[] cmdarray,
                     String[] envp,
                     java.io.File dir,
                     boolean cfor)
              throws java.io.IOException
java.io.IOException

availableProcessors

public int availableProcessors()
See Also:
OldRuntime.availableProcessors()

freeMemory

public long freeMemory()
See Also:
OldRuntime.freeMemory()

totalMemory

public long totalMemory()
See Also:
OldRuntime.totalMemory()

maxMemory

public long maxMemory()
See Also:
OldRuntime.maxMemory()

gc

public void gc()
See Also:
OldRuntime.gc()

runFinalization0

private static void runFinalization0()

runFinalization

public void runFinalization()
See Also:
OldRuntime.runFinalization()

traceInstructions

public void traceInstructions(boolean on)
See Also:
OldRuntime.traceInstructions(boolean)

traceMethodCalls

public void traceMethodCalls(boolean on)
See Also:
OldRuntime.traceMethodCalls(boolean)

load

public void load(String filename)
See Also:
OldRuntime.load(String)

load0

void load0(Class fromClass,
           String filename)

loadLibrary

public void loadLibrary(String libname)
See Also:
OldRuntime.loadLibrary(String)

loadLibrary0

void loadLibrary0(Class fromClass,
                  String libname)

getLocalizedInputStream

public java.io.InputStream getLocalizedInputStream(java.io.InputStream in)
See Also:
OldRuntime.getLocalizedInputStream(InputStream)

getLocalizedOutputStream

public java.io.OutputStream getLocalizedOutputStream(java.io.OutputStream out)
See Also:
OldRuntime.getLocalizedOutputStream(OutputStream)

calledFromOldRuntime

private static boolean calledFromOldRuntime()