Java Troubleshooting Guide for HP-UX Systems

at java.net.InetSocketAddress.<init>(InetSocketAddress.java:124)
at java.net.Socket.<init>(Socket.java:178)
at Test.main(Test.java:7)
1.12 JAVA_TOOL_OPTIONS Environment Variable
The command line used to start an application is not always readily accessible in many
environments. This is especially true with applications that use embedded Java VMs or ones
where the startup is deeply nested in scripts. In these environments, the JAVA_TOOL_OPTIONS
environment variable may be useful to add options to the command line when the application
is run. This environment variable is primarily intended to support the initialization of tools,
specifically the launching of native or Java agents using the -agentlib or -javaagent options.
The JAVA_TOOL_OPTIONS environment variable is processed at the time of the invocation of
the Java VM. When this environment variable is set, the JNI_Create_JavaVM() function
prepends the value of the environment variable to the options supplied in its JavaVMInitArgs
argument. For security reasons this option is disabled in setuid processes; that is, processes where
the effective user or group ID differs from the real user or group ID.
In the following example, the environment variable is set to launch the hprof profiler when the
application is started:
$ export JAVA_TOOL_OPTIONS=-agentlib:hprof
Although this environment variable is intended to support the initialization of tools, it is also
useful for augmenting the command line with options for diagnostics purposes. For example,
you could use it to add the -XX:OnError option to the command line when it would be helpful
for a script or command to be executed when a fatal error occurred.
Because this environment variable is processed when JNI_CreateJavaVM() is called, it cannot
be used to augment the Java launcher options. Some examples of these launcher options are the
following VM selection options:
java -d64
java -client
java -server
To pass arguments to the Java launcher, set the JAVA_LAUNCHER_OPTIONS environment variable
to a string containing the desired arguments.
This environment variable is fully described in the JVMTI specification at:
http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html#tooloptions
1.13 jconsole (1.5+ only)
The jconsole command launches a graphical console tool that enables you to monitor and
manage Java applications on a local or remote machine.
jconsole can attach to any application that is started with the Java Management Extensions
(JMX) agent. A system property defined on the command line enables the JMX agent. Once
attached, jconsole can be used to display useful information such as thread usage, memory
consumption, and details about class loading, runtime compilation, and the operating system.
In addition to monitoring, jconsole can be used to dynamically change several parameters in
the running system. For example, the setting of the -verbose:gc option can be changed so that
garbage collection trace output can be dynamically enabled or disabled for a running application.
To use jconsole:
38 Diagnostic and Monitoring Tools and Options