| Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
| PREV | NEXT | SHOW LISTS | HIDE LISTS | ||
java.lang.Object
|
+----java.lang.Runtime
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.
An application cannot create its own instance of this class.
| Inner Class Summary | |
| static | Runtime.MemoryAdvice
MemoryAdvice interface defines the values returned by
the getMemoryAdvice and waitForMemoryAdvice
methods of the Runtime class.
|
| Method Summary | |
| Process | exec(String command)
|
| Process | exec(String command,
String[] envp)
|
| Process | exec(String[] cmdarray)
|
| Process | exec(String[] cmdarray,
String[] envp)
|
| void | exit(int status)
|
| long | freeMemory()
|
| void | gc()
|
| InputStream | getLocalizedInputStream(InputStream in)
|
| OutputStream | getLocalizedOutputStream(OutputStream out)
|
| int | getMemoryAdvice()
|
| static Runtime | getRuntime()
|
| void | load(String filename)
|
| void | loadLibrary(String libname)
|
| void | runFinalization()
|
| static void | runFinalizersOnExit(boolean value)
|
| long | totalMemory()
|
| void | traceInstructions(boolean on)
|
| void | traceMethodCalls(boolean on)
|
| int | waitForMemoryAdvice(int level)
level.
|
| Methods inherited from class java.lang.Object |
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static Runtime getRuntime()
Runtime object associated with the current
Java application.public void exit(int status)
If there is a security manager, its checkExit method
is called with the status as its argument. This may result in a
security exception.
The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.
status
- exit status.
public static void runFinalizersOnExit(boolean value)
public Process exec(String command) throws IOException
The command argument is parsed into tokens and then
executed as a command in a separate process. This method has
exactly the same effect as exec(command, null).
command
- a specified system command.
Process object for managing the subprocess.
public Process exec(String command,
String[] envp) throws IOException
This method breaks the command string into tokens and
creates a new array cmdarray containing the tokens; it
then performs the call exec(cmdarray, envp).
command
- a specified system command.
envp
- array containing environment in format
name=value
Process object for managing the subprocess.public Process exec(String[] cmdarray) throws IOException
The command specified by the tokens in cmdarray is
executed as a command in a separate process. This has exactly the
same effect as exec(cmdarray, null).
cmdarray
- array containing the command to call and
its arguments.
Process object for managing the subprocess.
public Process exec(String[] cmdarray,
String[] envp) throws IOException
If there is a security manager, its checkExec method
is called with the first component of the array
cmdarray as its argument. This may result in a security
exception.
Given an array of strings cmdarray, representing the
tokens of a command line, and an array of strings envp,
representing an "environment" that defines system
properties, this method creates a new process in which to execute
the specified command.
cmdarray
- array containing the command to call and
its arguments.
envp
- array containing environment in format
name=value.
Process object for managing the subprocess.public long freeMemory()
totalMemory method. Calling the gc method may
result in increasing the value returned by freeMemory.public long totalMemory()
public void gc()
The name gc stands for "garbage
collector". The Java Virtual Machine performs this recycling
process automatically as needed even if the gc method
is not invoked explicitly.
public void runFinalization()
finalize methods of objects
that have been found to be discarded but whose finalize
methods have not yet been run. When control returns from the
method call, the Java Virtual Machine has made a best effort to
complete all outstanding finalizations.
The Java Virtual Machine performs the finalization process
automatically as needed if the runFinalization method
is not invoked explicitly.
public void traceInstructions(boolean on)
boolean argument is true, this
method asks the Java Virtual Machine to print out a detailed trace
of each instruction in the Java Virtual Machine as it is executed.
The virtual machine may ignore this request if it does not support
this feature. The destination of the trace output is system
dependent.
If the boolean argument is false, this
method causes the Java Virtual Machine to stop performing the
detailed instruction trace it is performing.
on
- true to enable instruction tracing;
false to disable this feature.
public void traceMethodCalls(boolean on)
boolean argument is true, this
method asks the Java Virtual Machine to print out a detailed trace
of each method in the Java Virtual Machine as it is called. The
virtual machine may ignore this request if it does not support
this feature. The destination of the trace output is system dependent.
If the boolean argument is false, this
method causes the Java Virtual Machine to stop performing the
detailed method trace it is performing.
on
- true to enable instruction tracing;
false to disable this feature.
public void load(String filename)
java_g it will automagically insert "_g" before the
".so" (for example
Runtime.getRuntime().load("/home/avh/lib/libX11.so");).
If there is a security manager, its checkLink method
is called with the filename as its argument. This may
result in a security exception.
filename
- the file to load.
public void loadLibrary(String libname)
First, if there is a security manager, its checkLink
method is called with the filename as its argument.
This may result in a security exception.
If this method is called more than once with the same library name, the second and subsequent calls are ignored.
libname
- the name of the library.
public InputStream getLocalizedInputStream(InputStream in)
InputStreamReader and BufferedReader
classes.
InputStream and returns an InputStream
equivalent to the argument in all respects except that it is
localized: as characters in the local character set are read from
the stream, they are automatically converted from the local
character set to Unicode.
If the argument is already a localized stream, it may be returned as the result.
public OutputStream getLocalizedOutputStream(OutputStream out)
OutputStreamWriter, BufferedWriter, and
PrintWriter classes.
OutputStream and returns an
OutputStream equivalent to the argument in all respects
except that it is localized: as Unicode characters are written to
the stream, they are automatically converted to the local
character set.
If the argument is already a localized stream, it may be returned as the result.
public int waitForMemoryAdvice(int level) throws InterruptedException
level.
If the current level is different from level, return that
level immediately. Otherwise block until the level changes.
This method is intended primarily for use in the implementation of caches that flush cache entries according to the amount of memory available.
level
- One of GREEN, YELLOW,
ORANGE, or RED; these
constants are defined in the
Runtime.MemoryAdvice interface
public int getMemoryAdvice()
| Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
| PREV | NEXT | SHOW LISTS | HIDE LISTS | ||