Class java.lang.Runtime
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.
-
getLocalizedOutputStream(OutputStream)
- Localize an output stream.
-
getRuntime()
- Return 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.
-
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()
- Return 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.
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)
- Localize an input stream. A localized input stream will automatically
translate the input from the local format to UNICODE.
getLocalizedOutputStream
public OutputStream getLocalizedOutputStream(OutputStream out)
- Localize an output stream. A localized output stream will automatically
translate the output from UNICODE to the local format.
All Packages Class Hierarchy This Package Previous Next Index