GeezerVison is showing docs.oracle.com — Runtime (Java SE 11 & JDK 11 )
-
-
Nested Class Summary
Nested Classes
| Modifier and Type |
Class |
Description |
static class |
Runtime.Version |
A representation of a version string for an implementation of the
Java SE Platform.
|
-
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.
|
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.
|
long |
totalMemory() |
Returns the total amount of memory in the Java virtual machine.
|
void |
traceInstructions(boolean on) |
Deprecated, for removal: This API element is subject to removal in a future version.
This method was intended to control instruction tracing.
|
void |
traceMethodCalls(boolean on) |
Deprecated, for removal: This API element is subject to removal in a future version.
This method was intended to control method call tracing.
|
static Runtime.Version |
version() |
|
-
Methods declared in 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.
-
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.
-
traceInstructions
@Deprecated(since="9",
forRemoval=true)
public void traceInstructions(boolean on)
Deprecated, for removal: This API element is subject to removal in a future version.
This method was intended to control instruction tracing.
It has been superseded by JVM-specific tracing mechanisms.
This method is subject to removal in a future version of Java SE.
Not implemented, does nothing.
- Parameters:
on - ignored
-
traceMethodCalls
@Deprecated(since="9",
forRemoval=true)
public void traceMethodCalls(boolean on)
Deprecated, for removal: This API element is subject to removal in a future version.
This method was intended to control method call tracing.
It has been superseded by JVM-specific tracing mechanisms.
This method is subject to removal in a future version of Java SE.
Not implemented, does nothing.
- Parameters:
on - ignored
|