All Packages Class Hierarchy This Package Previous Next Index
Class java.lang.Runtime
java.lang.Object
|
+----java.lang.Runtime
- public class Runtime
- extends Object
-
exec(String)
- Executes the system command specified in the parameter.
-
exec(String, String[])
- Executes the system command specified in the parameter.
-
exec(String[])
- Executes the system command specified by cmdarray[0] with arguments
specified by the strings in the rest of the array.
-
exec(String[], String[])
- Executes the system command specified by cmdarray[0] with arguments
specified by the strings in the rest of the array.
-
exit(int)
- Exits the virtual machine with an exit code.
-
freeMemory()
- Returns the number of free bytes in system memory.
-
gc()
- Runs the garbage collector.
-
getLocalizedInputStream(InputStream)
- Localize an input stream.
Deprecated.
-
getLocalizedOutputStream(OutputStream)
- Localize an output stream.
Deprecated.
-
getRuntime()
- Returns the runtime.
-
load(String)
- Loads a dynamic library, given a complete path name.
-
loadLibrary(String)
- Loads a dynamic library with the specified library name.
-
runFinalization()
- Runs the finalization methods of any objects pending finalization.
-
runFinalizersOnExit(boolean)
- Enable or disable finalization on exit; doing so specifies that the
finalizers of all objects that have finalizers that have not yet been
automatically invoked are to be run before the Java runtime exits.
-
totalMemory()
- Returns the total number of bytes in system memory.
-
traceInstructions(boolean)
- Enables/Disables tracing of instructions.
-
traceMethodCalls(boolean)
- Enables/Disables tracing of method calls.
getRuntime
public static Runtime getRuntime()
- Returns the runtime.
exit
public void exit(int status)
- Exits the virtual machine with an exit code. This method does
not return, use with caution.
- Parameters:
- status - exit status, 0 if successful, other values indicate
various error types.
runFinalizersOnExit
public static void runFinalizersOnExit(boolean value)
- Enable or disable finalization on exit; doing so specifies that the
finalizers of all objects that have finalizers that have not yet been
automatically invoked are to be run before the Java runtime exits.
By default, finalization on exit is disabled. An invocation of
the runFinalizersOnExit method is permitted only if the caller is
allowed to exit, and is otherwise rejected by the security manager.
- See Also:
- gc, exit
exec
public Process exec(String command) throws IOException
- Executes the system command specified in the parameter.
Returns a Process which has methods for optaining the stdin,
stdout, and stderr of the subprocess. This method fails if
executed by untrusted code.
- Parameters:
- command - a specified system command
- Returns:
- an instance of class Process
exec
public Process exec(String command,
String envp[]) throws IOException
- Executes the system command specified in the parameter.
Returns a Process which has methods for optaining the stdin,
stdout, and stderr of the subprocess. This method fails if
executed by untrusted code.
- Parameters:
- command - a specified system command
- Returns:
- an instance of class Process
exec
public Process exec(String cmdarray[]) throws IOException
- Executes the system command specified by cmdarray[0] with arguments
specified by the strings in the rest of the array.
Returns a Process which has methods for optaining the stdin,
stdout, and stderr of the subprocess. This method fails if
executed by untrusted code.
- Parameters:
- an - array containing the command to call and its arguments
- envp - array containing environment in format name=value
- Returns:
- an instance of class Process
exec
public Process exec(String cmdarray[],
String envp[]) throws IOException
- Executes the system command specified by cmdarray[0] with arguments
specified by the strings in the rest of the array.
Returns a Process which has methods for optaining the stdin,
stdout, and stderr of the subprocess. This method fails if
executed by untrusted code.
- Parameters:
- an - array containing the command to call and its arguments
- envp - array containing environment in format name=value
- Returns:
- an instance of class Process
freeMemory
public long freeMemory()
- Returns the number of free bytes in system memory. This number
is not always accurate because it is just an estimation of the available
memory. More memory may be freed by calling System.gc() .
totalMemory
public long totalMemory()
- Returns the total number of bytes in system memory.
gc
public void gc()
- Runs the garbage collector.
runFinalization
public void runFinalization()
- Runs the finalization methods of any objects pending finalization.
Usually you will not need to call this method since finalization
methods will be called asynchronously by the finalization thread.
However, under some circumstances (like running out of a finalized
resource) it can be useful to run finalization methods synchronously.
traceInstructions
public void traceInstructions(boolean on)
- Enables/Disables tracing of instructions.
- Parameters:
- on - start tracing if true
traceMethodCalls
public void traceMethodCalls(boolean on)
- Enables/Disables tracing of method calls.
- Parameters:
- on - start tracing if true
load
public synchronized void load(String filename)
- Loads a dynamic library, given a complete path name. If you use this
from java_g it will automagically insert "_g" before the ".so".
Example:
Runtime.getRuntime().load("/home/avh/lib/libX11.so");
- Parameters:
- filename - the file to load
- Throws: UnsatisfiedLinkError
- If the file does not exist.
- See Also:
- getRuntime
loadLibrary
public synchronized void loadLibrary(String libname)
- Loads a dynamic library with the specified library name. The
call to LoadLibrary() should be made in the static
initializer of the first class that is loaded. Linking in the
same library more than once is ignored.
- Parameters:
- libname - the name of the library
- Throws: UnsatisfiedLinkError
- If the library does not exist.
getLocalizedInputStream
public InputStream getLocalizedInputStream(InputStream in)
- Note: getLocalizedInputStream() is deprecated.
As of JDK version 1.1, the preferred way translate from the
local encoding to Unicode is via the new InputStreamReader and
BufferedReader classes.
- Localize an input stream. A localized input stream will automatically
translate the input from the local format to Unicode.
- See Also:
- InputStreamReader, BufferedReader
getLocalizedOutputStream
public OutputStream getLocalizedOutputStream(OutputStream out)
- Note: getLocalizedOutputStream() is deprecated.
As of JDK version 1.1, the preferred way to translate from
Unicode into the local encoding is via the new OutputStreamWriter,
BufferedWriter, and PrintWriter classes.
- Localize an output stream. A localized output stream will automatically
translate the output from Unicode to the local format.
- See Also:
- OutputStreamWriter, BufferedWriter, PrintWriter
All Packages Class Hierarchy This Package Previous Next Index