Using System Resources |
At the core of the Java runtime environment are the Java virtual machine, the Java interpreter, and the host operating system.
The oval labelled Runtime in the diagram represents the current runtime environment and is an instance of the Runtime class (a member of the java.lang package). The current runtime environtment could be anything from Sun's implementation of the Java virtual machine and interpreter running on Solaris to ACME Company's implementation of the virtual machine and interpreter running on the ACME toaster.
Runtime objects provide two services. First, they communicate with the components of the runtime environment--getting information and invoking functions. Second, Runtime objects are also the interface to system-dependent capabilities. For example, UNIX runtime objects might support the
getenv()
andsetenv()
functions. Other runtime objects, such as MacOS, might not supportgetenv()
andsetenv()
(because the host operating system doesn't support these functions) but might support others.Because the Runtime class is tightly integrated with the implementation of the Java interpreter, the Java virtual machine, and the host operating system, it is system dependent. If objects in your program message the Runtime object directly, you sacrifice the system indepedent nature of you Java program. In general, this is not a good idea (particularly for applets).
See also
java.lang.Runtime
Using System Resources |