Communicator e3000 MPE/iX Release 7.0 Express 1 (Software Release C.70.01) (30216-90328)

122 Chapter5
Technical Articles
Introducing the HotSpot Virtual Machine for Java
The HotSpot versions of the same two files are located here:
/usr/local/java/jdk1.3/jre/lib/jvm.cfg
With MPE/iX 7.0 Express 1, the Java SDK included is configured with classic as the
default JVM. At some future release, probably based on SDK 1.3.1, we will change the
default JVM to be the HotSpot JVM. Later still, probably in a release based on SDK 1.4,
the Classic JVM will be dropped from the Java distribution. Customers are encouraged to
test all of their Java software using the HotSpot JVM at the earliest opportunity, so that
any compatibility problems can be identified and fixed before the discontinuance of the
Classic JVM.
How to use the HotSpot JVM
As mentioned above, the jvm.cfg file determines whether the Classic or HotSpot JVM will
be the default JVM for your system. You can also request a specific JVM on a case-by-case
basis by using the appropriate command line switch, for example:
java –hotspot HelloWorldselects the HotSpot JVM
java –classic HelloWorldselects the Classic JVM
If a VM option is specified, it must be the first argument on the command line. If no VM
option is specifed, the default VM (as configured in jvm.cfg) will be used.
There are a few additional files that will be referenced by the HotSpot VM if they are
present. When you invoke HotSpot, if there is a file named .hotspotrc in your current
working directory, this file will be read. This file can contain various switches to be passed
to the HotSpot Virtual Machine. For example, here is a possible .hotspotrc file:
# Sample .hotspotrc. Lines beginning with # are comments
+ServerApp
+PrintGC
MaxHeapSize=64000
The first two switches are boolean flags, which can be turned on by a leading +, or off by a
leading -. +ServerApp causes the VM to inline more aggressively, which uses more
memory, may slow down compilations and may make smaller apps run slower, but which
can provide a performance benefit for larger, longer running applications. The second flag
is equivalent to the –verbose:gc switch on the Classic VM (and –verbose:gc can still be
specified on HotSpot as an alternative to this new syntax). The third flag is an integer
flag, which specifies a value (the size of the VM heap, in Kbytes). The exact set of flags
available is still undergoing change at the time this article is written, and may evolve over
the course of the next several releases. For this reason, you should not rely on the
presence or behavior of any particular VM flags at this point.
As an alternative to using the .hotspotrc file, you can also set these flags directly on the
command line by using a –XX: prefix, for example, -XX:+ServerApp would turn on the
ServerApp flag. Finally, you can use an alternate file rather than .hotspotrc, and specify
your alternate file by passing –XX:Flags=filename on the java command line.
Another file that will be read at startup time is the .hotspot_compiler file. This file is