GeezerVison is showing docs.oracle.com — Runtime (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
- Summary:
- Nested |
- Field |
- Constr |
- Method
- Detail:
- Field |
- Constr |
- Method
compact1, compact2, compact3
java.lang
Class Runtime
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
| Modifier and Type |
Method |
Description |
void |
addShutdownHook(Thread hook) |
Registers a new virtual-machine shutdown hook.
|
int |
availableProcessors() |
Returns the number of processors available to the Java virtual machine.
|
Process |
exec(String command) |
Executes the specified string command in a separate process.
|
Process |
exec(String[] cmdarray) |
Executes the specified command and arguments in a separate process.
|
Process |
exec(String[] cmdarray,
String[] envp) |
Executes the specified command and arguments in a separate process
with the specified environment.
|
Process |
exec(String[] cmdarray,
String[] envp,
File dir) |
Executes the specified command and arguments in a separate process with
the specified environment and working directory.
|
Process |
exec(String command,
String[] envp) |
Executes the specified string command in a separate process with the
specified environment.
|
Process |
exec(String command,
String[] envp,
File dir) |
Executes the specified string command in a separate process with the
specified environment and working directory.
|
void |
exit(int status) |
Terminates the currently running Java virtual machine by initiating its
shutdown sequence.
|
long |
freeMemory() |
Returns the amount of free memory in the Java Virtual Machine.
|
void |
gc() |
Runs the garbage collector.
|
InputStream |
getLocalizedInputStream(InputStream in) |
Deprecated.
As of JDK 1.1, the preferred way to translate a byte
stream in the local encoding into a character stream in Unicode is via
the InputStreamReader and BufferedReader
classes.
|
OutputStream |
getLocalizedOutputStream(OutputStream out) |
Deprecated.
As of JDK 1.1, the preferred way to translate a
Unicode character stream into a byte stream in the local encoding is via
the OutputStreamWriter, BufferedWriter, and
PrintWriter classes.
|
static Runtime |
getRuntime() |
Returns the runtime object associated with the current Java application.
|
void |
halt(int status) |
Forcibly terminates the currently running Java virtual machine.
|
void |
load(String filename) |
Loads the native library specified by the filename argument.
|
void |
loadLibrary(String libname) |
Loads the native library specified by the libname
argument.
|
long |
maxMemory() |
Returns the maximum amount of memory that the Java virtual machine will
attempt to use.
|
boolean |
removeShutdownHook(Thread hook) |
De-registers a previously-registered virtual-machine shutdown hook.
|
void |
runFinalization() |
Runs the finalization methods of any objects pending finalization.
|
static void |
runFinalizersOnExit(boolean value) |
Deprecated.
This method was originally designed to enable or disable
running finalizers on exit. Running finalizers on exit was disabled by default.
If enabled, then the finalizers of all objects whose finalizers had not
yet been automatically invoked were to be run before the Java runtime exits.
That behavior is inherently unsafe. It may result in finalizers being called
on live objects while other threads are concurrently manipulating those objects,
resulting in erratic behavior or deadlock.
|
long |
totalMemory() |
Returns the total amount of memory in the Java virtual machine.
|
void |
traceInstructions(boolean on) |
Enables/Disables tracing of instructions.
|
void |
traceMethodCalls(boolean on) |
Enables/Disables tracing of method calls.
|
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getRuntime
public static Runtime getRuntime()
Returns the runtime object associated with the current Java application.
Most of the methods of class Runtime are instance
methods and must be invoked with respect to the current runtime object.
- Returns:
- the
Runtime object associated with the current
Java application.
-
runFinalizersOnExit
@Deprecated
public static void runFinalizersOnExit(boolean value)
Deprecated. This method was originally designed to enable or disable
running finalizers on exit. Running finalizers on exit was disabled by default.
If enabled, then the finalizers of all objects whose finalizers had not
yet been automatically invoked were to be run before the Java runtime exits.
That behavior is inherently unsafe. It may result in finalizers being called
on live objects while other threads are concurrently manipulating those objects,
resulting in erratic behavior or deadlock.
Throws UnsupportedOperationException.
- Parameters:
value - ignored
- Since:
- JDK1.1
-
maxMemory
public long maxMemory()
Returns the maximum amount of memory that the Java virtual machine will
attempt to use. If there is no inherent limit then the value Long.MAX_VALUE will be returned.
- Returns:
- the maximum amount of memory that the virtual machine will
attempt to use, measured in bytes
- Since:
- 1.4
-
gc
public void gc()
Runs the garbage collector.
Calling this method suggests that the Java virtual machine expend
effort toward recycling unused objects in order to make the memory
they currently occupy available for quick reuse. When control
returns from the method call, the virtual machine has made
its best effort to recycle all discarded objects.
The name gc stands for "garbage
collector". The virtual machine performs this recycling
process automatically as needed, in a separate thread, even if the
gc method is not invoked explicitly.
The method System.gc() is the conventional and convenient
means of invoking this method.
-
getLocalizedInputStream
@Deprecated
public InputStream getLocalizedInputStream(InputStream in)
Deprecated. As of JDK 1.1, the preferred way to translate a byte
stream in the local encoding into a character stream in Unicode is via
the InputStreamReader and BufferedReader
classes.
Creates a localized version of an input stream. This method takes
an 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.
- Parameters:
in - InputStream to localize
- Returns:
- a localized input stream
- See Also:
InputStream,
BufferedReader.BufferedReader(java.io.Reader),
InputStreamReader.InputStreamReader(java.io.InputStream)
Java™ Platform Standard Ed. 8
- Summary:
- Nested |
- Field |
- Constr |
- Method
- Detail:
- Field |
- Constr |
- Method
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|