Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Java™ Troubleshooting Guide for HP-UX Systems: > Chapter 1 Diagnostic and Monitoring Tools and Options

JAVA_TOOL_OPTIONS Environment Variable

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

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

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2009 Hewlett-Packard Development Company, L.P.