Java Reference
In-Depth Information
23.4. The Rest of
Runtime
The
Runtime
class provides functionality in six different areas:
•
Interacting with the garbage collector and querying memory usage
•
Asking for the number of processors available
•
Executing external programs
•
Terminating the current
Runtime
•
Loading native code libraries
•
Debugging
You have already learned about the first four of these areas (you learned
about interacting with the garbage collector via the
gc
and
runFinalization
Chapter 14
on page
359
)
. Now is the time to cover the final two.
23.4.1. Loading Native Code
can be applied to methods and which signifies that the method's imple-
mentation is being provided by native code. At runtime the native code
for such methods must be loaded into the virtual machine so that the
methods can be executed. The details of this process are system-depend-
ent, but two methods in
Runtime
allow this activity to occur:
public void
loadLibrary(String libname)
Loads the dynamic library with the specified library name. The
library corresponds to a file in the local file system that is loc-
ated in some place where the system knows to look for library