# IBM SDK for Linux platforms, Java Technology Edition

# SDK and Runtime Guide

Version 5 Release 0
Note

Before using this information and the product it supports, read the information in Notices.

Copyright information

This edition of the user guide applies to the IBM SDK and Runtime Environment for Linux on multiple platforms.

The platforms this guide applies to are:

- IBM 32-bit SDK and Runtime Environment for Linux on Intel architecture, Java 2 Technology Edition, Version 5.0
- IBM 64-bit SDK and Runtime Environment for Linux on AMD64/EM64T architecture, Java 2 Technology Edition, Version 5.0
- IBM 32-bit SDK and Runtime Environment for Linux on System i® and System p® architecture, Java 2 Technology Edition, Version 5.0
- IBM 64-bit SDK and Runtime Environment for Linux on System i and System p architecture, Java 2 Technology Edition, Version 5.0
- IBM 31-bit SDK and Runtime Environment for Linux on System z architecture, Java 2 Technology Edition, Version 5.0
- IBM 64-bit SDK and Runtime Environment for Linux on System z architecture, Java 2 Technology Edition, Version 5.0

and all subsequent releases and modifications until otherwise indicated in new editions.

© Copyright Sun Microsystems, Inc. 1997, 2004, 901 San Antonio Rd., Palo Alto, CA 94303 USA. All rights reserved.

Copyright International Business Machines Corporation 2003, 2010.
US Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

# Contents

Preface
Overview
Linux conventions
Version compatibility
Migrating from other IBM JVMs
Supported hardware for System z
Contents of the SDK and Runtime Environment
Contents of the Runtime Environment
Contents of the SDK
Installing and configuring the SDK and Runtime Environment
Upgrading the SDK
Installing on Red Hat Enterprise Linux (RHEL) 4
Installing on Red Hat Enterprise Linux (RHEL) 5
Running Java with SELinux on RHEL 5
Installing on Ubuntu
Installing a 32-bit SDK on 64-bit architecture
Installing from a `.rpm` file
Installing from a `.tgz` file
Using a JPackage compatible format
Configuring the SDK and Runtime Environment for Linux
Setting the path
Setting the class path
Updating your SDK or JRE for daylight saving time changes
Uninstalling the SDK and Runtime Environment for Linux
Uninstalling the Red Hat Package Manager (RPM) package
Uninstalling the compressed Tape Archive (TAR) package
Running Java applications
The java and javaw commands
Obtaining version information
Specifying Java options and system properties
Standard options
Globalization of the java command
The Just-In-Time (JIT) compiler
Disabling the JIT
Enabling the JIT
Determining whether the JIT is enabled
Specifying garbage collection policy
Garbage collection options
Pause time
Pause time reduction
Environments with very full heaps
Working with floating stacks
Euro symbol support
Support for Serbian locale
Fallback font configuration files
Developing Java applications
Transforming XML documents
Using an older version of Xerces or Xalan
Debugging Java applications
Java Debugger (JDB)
Determining whether your application is running on a 32-bit or 64-bit JVM
How the JVM processes signals
Signals used by the JVM
Linking a native code driver to the signal-chaining library
Writing JNI applications
Support for thread-level recovery of blocked connectors
Configuring large page memory allocation
CORBA support
System properties for tracing the ORB
System properties for tuning the ORB
Java security permissions for the ORB
ORB implementation classes
RMI over IIOP
Implementing the Connection Handler Pool for RMI
Enhanced BigDecimal
Support for XToolkit
Support for the Java Attach API
Plug-in, Applet Viewer and Web Start
(Linux IA 32-bit and PPC32 only) Using the Java plug-in
Supported browsers
Installing the Java plug-in
Common Document Object Model (DOM) support
Using DBCS parameters
Working with applets
Running and debugging applets with the Applet Viewer
(Linux IA 32-bit, PPC32, and PPC64 only) Using Web Start
Running Web Start
(Linux IA 32-bit only) WebStart Secure Static Versioning
Distributing Java applications
Class data sharing between JVMs
Overview of class data sharing
Class data sharing command-line options
Creating, populating, monitoring, and deleting a cache
Performance and memory consumption
Considerations and limitations of using class data sharing
Cache size limits
Runtime bytecode modification
Operating system limitations
Using SharedClassPermission
Adapting custom classloaders to share classes
Java Communications API (JavaComm)
Installing Java Communications API from a compressed file
Installing the Java Communications API from an RPM file
Location of the Java Communications API files
Configuring the Java Communications API
Changing the access mode of serial and parallel ports
Specifying devices in the `javax.comm.properties` file
Enabling serial ports on IBM ThinkPads
Printing limitation with the Java Communications API
Uninstalling Java Communications API
Uninstalling the Red Hat Package Manager (RPM) package
Uninstalling the compressed Tape Archive (TAR) package
The Java Communications API documentation
Service and support for independent software vendors
Accessibility
Keyboard traversal of JComboBox components in Swing
Web Start accessibility (Linux IA 32-bit, PPC32, and PPC64 only)
Any comments on this user guide?
Appendix A. Command-line options
Specifying command-line options
General command-line options
System property command-line options
JVM command-line options
-XX command-line options
JIT command-line options
Garbage Collector command-line options
Appendix B. Known limitations
Notices
Trademarks

# Preface

This user guide provides general information about the IBM® SDK and Runtime Environment for Linux® platforms, Java™ 2 Technology Edition, Version 5.0. The user guide gives specific information about any differences in the IBM implementation compared with the Sun implementation.

Read this user guide with the more extensive documentation on the Sun Web site: http://java.sun.com.

For the list of distributions against which the SDK and Runtime Environment for Linux have been tested, see: http://www.ibm.com/developerworks/java/jdk/linux/tested50.html.

(Intel® 32-bit platforms only) From Version 5.0, Service Refresh 5, these Virtualized Environments are supported:

- VMWare
- Xen
- Microsoft® Virtual Server

The Diagnostics Guide provides more detailed information about the IBM Virtual Machine for Java.

This user guide is part of a release and is applicable only to that particular release. Make sure that you have the user guide appropriate to the release you are using.

The terms "Runtime Environment" and "Java Virtual Machine" are used interchangeably throughout this user guide.

Technical changes made for this version of the user guide, other than minor or obvious ones, are indicated by blue chevrons when viewing in an Information Center, by blue chevrons and in red when viewing in HTML, or by vertical bars to the left of the changes when viewing as a PDF file.

The Program Code is not designed or intended for use in real-time applications such as (but not limited to) the online control of aircraft, air traffic, aircraft navigation, or aircraft communications; or in the design, construction, operation, or maintenance of any nuclear facility.

# Overview

The IBM SDK is a development environment for writing and running applets and applications that conform to the Java 5.0 Core Application Program Interface (API).

The SDK includes the Runtime Environment for Linux, which enables you only to run Java applications. If you have installed the SDK, the Runtime Environment is included.

The Runtime Environment contains the Java Virtual Machine and supporting files including non-debuggable .so files and class files. The Runtime Environment contains only a subset of the classes that are found in the SDK and allows you to support a Java program at runtime but does not provide compilation of Java programs. The Runtime Environment for Linux does not include any of the development tools, for example appletviewer or the Java compiler (javac), or classes that are only for development systems.

In addition, for IA32, PPC32/PPC64, and AMD64/EM64T platforms, the Java Communications application programming interface (API) package is provided for use with the Runtime Environment for Linux. You can find information about it in Java Communications API (JavaComm).

The `license_xx.html` file contains the license agreement for the Runtime Environment for Linux software, where xx is an abbreviation for the language. To view or print the license agreement, open the file in a Web browser.

## Linux conventions

In this documentation, the default installation directory of the SDK is referred to as /opt/ibm/java2-<arch>-50/, where <arch> is the architecture of your platform.

The default installation directories for the various architectures are listed here; replace the directory for the architecture you are using when you see /opt/ibm/java2-<arch>-50/:

- Linux IA 32-bit: /opt/ibm/java2-i386-50/
- Linux AMD 64-bit: /opt/ibm/java2-x86_64-50/
- Linux PPC 32-bit: /opt/ibm/java2-ppc-50/
- Linux PPC 64-bit: /opt/ibm/java2-ppc64-50/
- Linux System z® 31-bit: /opt/ibm/java2-s390-50/
- Linux System z 64-bit: /opt/ibm/java2-s390x-50/

Korn shell commands are used in examples throughout this user guide.

## Version compatibility

In general, any applet or application that ran with a previous version of the SDK should run correctly with the IBM SDK for Linux, v5.0. Classes compiled with this release are not guaranteed to work on previous releases.

For information about compatibility issues between releases, see the Sun Web site at:

http://java.sun.com/j2se/5.0/compatibility.html

http://java.sun.com/j2se/1.4/compatibility.html

http://java.sun.com/j2se/1.3/compatibility.html

If you are using the SDK as part of another product (for example, IBM WebSphere® Application Server), and you upgrade from a previous level of the SDK, perhaps v1.4.2, serialized classes might not be compatible. However, classes are compatible between service refreshes.

## Migrating from other IBM JVMs

From Version 1.4.2 for AMD64/EM64T and Version 5 for the other Linux platforms, the IBM Runtime Environment for Linux contains a new version of the IBM Virtual Machine for Java and the Just-In-Time (JIT) compiler.

If you are migrating from an older IBM Runtime Environment, note that:

- To remain compatible with Version 1.4.2, the JVM shared library libjvm.so is installed in both jre/bin/j9vm and jre/bin/classic. Set the LIBPATH environment variable to use the JVM shared library in jre/bin/classic when writing native applications using the JNI invocation interface.
- The JVM Monitoring Interface (JVMMI) is no longer available. You must rewrite applications that used that API. You are recommended to use the JVM Tool Interface (JVMTI) instead. The JVMTI is not functionally the equivalent of JVMMI. For information about JVMTI, see http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/ and the Diagnostics Guide.
- The new implementation of JNI conforms to the JNI specification, but differs from the old implementation. It returns copies of objects rather than pinning the objects. This difference can expose errors in JNI application code. For information about debugging JNI code, see -Xcheck:jni in JVM command-line options.
- The format and content of garbage collector verbose logs obtained using -verbose:gc have changed. The data is now formatted as XML. The data content reflects the changes to the implementation of garbage collection in the JVM, and most of the statistics that are produced have changed. You must change any programs that process the verbose GC data to make them work with the new format and data. See the Diagnostics Guide for an example of the new verbose GC data.
- SDK 1.4 versions of the IBM JRE included JVM specific classes in a file called core.jar. From Java 5.0 onwards, these are included in a file called `vm.jar`.
- Earlier versions of the IBM JRE included a file called `rt.jar` in the `jre/lib` directory. From Java v1.4 onwards, this file has been replaced by multiple JAR files in the `jre/lib` directory.
- For additional industry compatibility information, see Sun's Java 5 Compatibility Documentation: http://java.sun.com/j2se/5.0/compatibility.html
- For additional deprecated API information, see Sun's Java 5 Deprecated API List: http://java.sun.com/j2se/1.5.0/docs/api/deprecated-list.html
- Tracing class dependencies, started using -verbose:Xclassdep, is not supported. If you specify -verbose:Xclassdep, the JVM will issue an error message and will not start.
- The JVM detects the operating system locale and sets the language preferences accordingly. For example, if the locale is set to fr_FR, JVM messages will be printed in French. To avoid seeing JVM messages in the language of the detected locale, remove the file `$SDK/jre/bin/java_xx.properties` where `xx` is the locale, such as fr, and the JVM will print messages in English.

## Supported hardware for System z

The System z 31-bit and 64-bit SDKs and Runtime Environments run on System z9® and zSeries® hardware.

The SDKs and Runtime Environments run on the following servers or equivalents:

- z9-109
- z990
- z900
- z890
- z800

# Contents of the SDK and Runtime Environment

The SDK contains several development tools and a Java Runtime Environment (JRE). This section describes the contents of the SDK tools and the Runtime Environment.

Applications written entirely in Java must have no dependencies on the IBM SDK's directory structure (or files in those directories). Any dependency on the SDK's directory structure (or the files in those directories) might result in application portability problems.

The user guides, Javadoc files, demo files, and the accompanying license and copyright files are the only documentation included in this SDK for Linux. You can view Sun's software documentation by visiting the Sun Web site, or you can download Sun's software documentation package from the Sun Web site: http://java.sun.com.

## Contents of the Runtime Environment

A list of classes, tools, and other files that you can use with the standard Runtime Environment.

- Core Classes - These classes are the compiled class files for the platform and must remain compressed for the compiler and interpreter to access them. Do not modify these classes; instead, create subclasses and override where you need to.
- Trusted root certificates from certificate signing authorities - These certificates are used to validate the identity of signed material.
- JRE tools - The following tools are part of the Runtime Environment and are in the /opt/ibm/java2-<arch>-50/jre/bin directory unless otherwise specified.
  ControlPanel (Java Control Panel)
    (Except System z and AMD 64-bit platforms) Configures your Runtime Environment.
  ikeyman (iKeyman GUI utility)
    Allows you to manage keys, certificates, and certificate requests. For more information see the accompanying Security Guide and http://public.dhe.ibm.com/software/dw/jdk/security/50/GSK7c_SSL_IKM_Guide.pdf. The SDK also provides a command-line version of this utility.
  java (Java Interpreter)
    Runs Java classes. The Java Interpreter runs programs that are written in the Java programming language.
  javaw (Java Interpreter)
    Runs Java classes in the same way as the java command does, but does not use a console window.
  (Linux IA 32-bit, PPC32, and PPC64 only) javaws (Java Web Start)
    Enables the deployment and automatic maintenance of Java applications. For more information, see Running Web Start.
  jextract (Dump extractor)
    Converts a system-produced dump into a common format that can be used by jdmpview. For more information, see jdmpview.
  keytool (Key and Certificate Management Tool)
    Manages a keystore (database) of private keys and their associated X.509 certificate chains that authenticate the corresponding public keys.
  policytool (Policy File Creation and Management Tool)
    Creates and modifies the external policy configuration files that define your installation's Java security policy.
  rmid (RMI activation system daemon)
    Starts the activation system daemon so that objects can be registered and activated in a Java virtual machine (JVM).
  rmiregistry (Java remote object registry)
    Creates and starts a remote object registry on the specified port of the current host.
  tnameserv (Common Object Request Broker Architecture (CORBA) transient naming service)
    Starts the CORBA transient naming service.
  (Linux IA 32-bit, PPC32, and PPC64 only) updateSettings.sh (Java Web Start settings)
    Configures your system to use Web Start with your browser. For more information, see Running Web Start. This file is installed in the jre/lib/javaws directory.

## Contents of the SDK

A list of tools and reference information that is included with the standard SDK.

The following tools are part of the SDK and are located in the /opt/ibm/java2-<arch>-50/bin directory:
  appletviewer (Java Applet Viewer)
    Tests and runs applets outside a Web browser.
  apt (Annotation Processing Tool)
    Finds and executes annotation processors based on the annotations present in the set of specified source files being examined.
  extcheck (Extcheck utility)
    Detects version conflicts between a target jar file and currently-installed extension jar files.
  (Linux IA 32-bit and PPC32) HtmlConverter (Java Plug-in HTML Converter)
    Converts an HTML page that contains applets to a format that can use the Java Plug-in.
  idlj (IDL to Java Compiler)
    Generates Java bindings from a given IDL file.
  jar (Java Archive Tool)
    Combines multiple files into a single Java Archive (JAR) file.
  jarsigner (JAR Signing and Verification Tool)
    Generates signatures for JAR files and verifies the signatures of signed JAR files.
  java-rmi.cgi (HTTP-to-CGI request forward tool)
    Accepts RMI-over-HTTP requests and forwards them to an RMI server listening on any port.
  javac (Java Compiler)
    Compiles programs that are written in the Java programming language into bytecodes (compiled Java code).
  javadoc (Java Documentation Generator)
    Generates HTML pages of API documentation from Java source files.
  javah (C Header and Stub File Generator)
    Enables you to associate native methods with code written in the Java programming language.
  javap (Class File Disassembler)
    Disassembles compiled files and can print a representation of the bytecodes.
  jconsole (JConsole Monitoring and Management Tool)
    Experimental (unsupported). Monitors local and remote JVMs using a GUI. JMX-compliant.
  jdb (Java Debugger)
    Helps debug your Java programs.
  jdmpview (Cross-platform dump formatter)
    Analyzes dumps. For more information, see the Diagnostics Guide.
  native2ascii (Native-To-ASCII Converter)
    Converts a native encoding file to an ASCII file that contains characters encoded in either Latin-1 or Unicode, or both.
  rmic (Java Remote Method Invocation (RMI) Stub Converter)
    Generates stubs, skeletons, and ties for remote objects. Includes RMI over Internet Inter-ORB Protocol (RMI-IIOP) support.
  serialver (Serial Version Command)
    Returns the serialVersionUID for one or more classes in a format that is suitable for copying into an evolving class.
Include Files
  C headers for JNI programs.
Demos
  The `demo` directory contains a number of subdirectories containing sample source code, demos, applications, and applets that you can use.
copyright
  The copyright notice for the SDK for Linux software.
License

  The License file, /opt/ibm/java2-<arch>-50/docs/<locale>/license_<locale>.html, contains the license agreement for the SDK for Linux software (where <locale> is the name of your locale, for example en). To view or print the license agreement, open the file in a Web browser.

fixes.lst
  A text file that describes any defects that are fixed after the initial release of this version.

# Installing and configuring the SDK and Runtime Environment

You can install the IBM Java SDK and Runtime Environment from either an RPM or a .tgz file. Unless you want to allow all the users on the workstation to access this Java installation, use the .tgz installation method. If you do not have root access, use the .tgz file.

If you install using an RPM file, the Java files are installed in /opt/ibm/java2-<arch>-50/. The examples in this guide assume that you have installed Java in this directory.

## Upgrading the SDK

If you are upgrading the SDK from a previous release, back up all the configuration files and security policy files before you start the upgrade.

### What to do next

After the upgrade, you might have to restore or reconfigure these files because they might have been overwritten during the upgrade process. Check the syntax of the new files before restoring the original files because the format or options for the files might have changed.

## Installing on Red Hat Enterprise Linux (RHEL) 4

The SDK depends on shared libraries that are not installed by default for Red Hat Enterprise Linux (RHEL).

### About this task

In RHEL 4, the RPMs that contain these libraries are:

- `compat-libstdc++-33-3.2.3` and `xorg-x11-deprecated-libs-6.8.1` (Platforms other than zSeries)
- `compat-libstdc++-295-2.95.3` and `xorg-x11-deprecated-libs-6.8.1` (zSeries)

To include these libraries during RHEL 4 installation:

### Procedure

1. When you reach the Package Defaults screen, select Customize the set of packages to be installed.
2. At the Package Group Selection screen, under X Windows System, choose Details and make sure that you have selected `xorg-x11-deprecated-libs`
3. Under the Development options, select Legacy Software Development.

## Installing on Red Hat Enterprise Linux (RHEL) 5

The SDK depends on shared libraries that are not installed by default for Red Hat Enterprise Linux (RHEL).

### About this task

In RHEL 5, these RPMs contain the shared libraries:

- `libXp-1.0.0-8` (All platforms)
- `compat-libstdc++-33-3.2.3` (Platforms other than zSeries)
- `compat-libstdc++-295-2.95.3` (zSeries)

To include these libraries during RHEL 5 installation:

### Procedure

1. At the software selection screen, select Customize now.
2. On the next screen, in the left panel, select Base System; in the right panel, select Legacy Software Support. These selections install the compat-libstdc++ packages.

### Running Java with SELinux on RHEL 5

On platforms with SELinux enabled, Java must be installed in the default directory or you must enable it manually. For PPC platforms, Java must be enabled manually.

#### About this task

If Java is not installed in the default directory, or you have to enable Java manually on PPC platforms, enter this command:

    chcon -R -t texrel_shlib_t <path_of_sdk>

Where <path_of_sdk> is the path where Java is installed.

For more information about SELinux, see Introduction to SELinux in the Red Hat documentation.

## Installing on Ubuntu

The IBM SDK for Java is not available as a `.deb` package. Use the `.tgz` package to install the SDK on Ubuntu. The SDK depends on other Ubuntu packages which are installed using the Ubuntu package manager.

For information about installing using the `.tgz` package, see Installing from a `.tgz` file.

### Required packages

The following Ubuntu packages are required for the IBM SDK for Java to run correctly. Install the packages using the Ubuntu package manager:

- gcc-3.3-base
- libc6
- libgcc1
- libstdc++5

### Errors installing using RPM

The following error is displayed if you try to install using RPM:

    error: Failed dependencies:
            glibc >= 2.3 is needed by ibm-java2-<arch>-sdk-5.0-10.0.<arch>
            libstdc++.so.5 is needed by ibm-java2-<arch>-sdk-5.0-10.0.<arch>
            /bin/sh is needed by ibm-java2-<arch>-sdk-5.0-10.0.<arch>
            libXp.so.6 is needed by ibm-java2-<arch>-sdk-5.0-10.0.<arch>

You can force RPM installation by using the --nodeps command-line option:

    rpm -ivh --nodeps ibm-java2-<arch>-sdk-5.0-10.0.<arch>.rpm

In this example, <arch> is the architecture of your system.

### Unreadable characters on Swing component

On systems that are configured for Chinese, Japanese, or Korean globalization, some characters on Java Swing components might not be readable because the font is unclear when anti-aliasing is not used. To improve the readability of the characters, set the swing.aatext property in the java or javaw command as follows:

    -Dswing.aatext=true

Alternatively, use the IBM_JAVA_OPTIONS environment variable to specify this property.

## Installing a 32-bit SDK on 64-bit architecture

To run the SDK, you must install the correct versions of all libraries required by the SDK, either 32- or 64-bit.

### About this task

In RHEL4, the 64-bit versions of the packages are available in the Compatibility Arch Support package group.

You can use the RPM tool to check which versions of the packages you have installed by adding the option `--queryformat "%{NAME}.%{ARCH}\n"` to your RPM command. For example:

    /home/username : rpm --queryformat "%{NAME}.%{ARCH}\n" -q libstdc++
    libstdc++.x86_64
    libstdc++.i386

## Installing from a `.rpm` file

A procedure for installing from a `.rpm` file.

### About this task

To upgrade your JVM using the rpm tool, you must uninstall any previous version. To install two versions of the JVM in different locations, use the rpm --force option to ignore the version conflict. Alternatively, install the JVM from the `.tgz` file.

### Procedure

1. Open a shell prompt, making sure that you are root.
2. At a shell prompt, type `rpm -ivh <RPM file>`. For example:

       rpm -ivh ibm-java2-<arch>-sdk-5.0-10.0.<arch>.rpm

   or

       rpm -ivh ibm-java2-<arch>-jre-5.0-10.0.<arch>.rpm

   Where `<arch>` represents your architecture: i386, x86_64, ppc, ppc64, s390, or s390x.

## Installing from a `.tgz` file

A procedure for installing from a `.tgz` file.

### Procedure

1. Create a directory to store the Java package files. The examples in this guide assume that you have installed in /opt/ibm/java2-<arch>-50/. In the rest of the guide, replace /opt/ibm/java2-<arch>-50/ with the directory in which you installed Java.
2. At a shell prompt, type `tar -zxvf <.tgz file>`.

       tar -zxvf ibm-java2-sdk-50-linux-<arch>.tgz

   or

       tar -zxvf ibm-java2-jre-50-linux-<arch>.tgz

   Where `<arch>` represents your architecture: i386, x86_64, ppc, ppc64, s390, or s390x.

3. If you are running Security-Enhanced Linux (SELinux), you must identify the Java shared libraries to the system. Type:

       chcon -R -t texrel_shlib_t /opt/ibm/java2-<arch>-50/jre
       chcon -R -t texrel_shlib_t /opt/ibm/java2-<arch>-50/bin
       chcon -R -t texrel_shlib_t /opt/ibm/java2-<arch>-50/lib

## Using a JPackage compatible format

From Version 5.0 Service Refresh 3, the IBM SDK for Linux, v5.0 is also available in a JPackage compatible format.

### Before you begin

To simplify managing the SDK, the various components of it are now available as separate RPMs: the base Java Runtime Environment, Development Kit, Plug-in, JDBC, Demo, Sound, Source, and Fonts. "jpackage-utils" RPM (downloadable from http://jpackage.org), which allows managing multiple Java RPMs on a system, is a prerequisite for the IBM SDKs. For more information about the JPackage specification, see http://jpackage.org.

If you install the SDK using JPackage, it is not installed in the default location. See the "Directory Structure" section of the JPackage Java™ infrastructure design and packaging policy for details about the default JPackage installation location: http://www.jpackage.org/cgi-bin/viewvc.cgi/src/jpackage-utils/doc/jpackage-1.5-policy.xhtml?root=jpackage&view=co

JPackage is not supported on the SLES9, SLES10, or SLES11 platforms.

## Configuring the SDK and Runtime Environment for Linux

Inconsistencies in the font encodings on Red Hat Advanced Server

Note: (For Linux IA 32-bit Chinese users only) Because of inconsistencies in the font encodings on Red Hat Advanced Server, when you install for an environment in which you want Chinese to be the default language, it is better to install with a default language of English and then change to Chinese after the installation is complete. Otherwise, you might find that the Chinese fonts do not display.

### Setting the path

If you alter the PATH environment variable, you will override any existing Java launchers in your path.

#### About this task

The PATH environment variable enables Linux to find programs and utilities, such as javac, java, and javadoc tool, from any current directory. To display the current value of your PATH, type the following at a command prompt:

    echo $PATH

To add the Java launchers to your path:

1. Edit the shell startup file in your home directory (typically .bashrc, depending on your shell) and add the absolute paths to the PATH environment variable; for example:

       export PATH=/opt/ibm/java2-<arch>-50/bin:/opt/ibm/java2-<arch>-50/jre/bin:$PATH

2. Log on again or run the updated shell script to activate the new PATH environment variable.

#### Results

After setting the path, you can run a tool by typing its name at a command prompt from any directory. For example, to compile the file `Myfile.Java`, at a command prompt, type:

    javac Myfile.Java

### Setting the class path

The class path tells the SDK tools, such as java, javac, and the javadoc tool, where to find the Java class libraries.

#### About this task

You should set the class path explicitly only if:

- You require a different library or class file, such as one that you develop, and it is not in the current directory.
- You change the location of the `bin` and `lib` directories and they no longer have the same parent directory.
- You plan to develop or run applications using different runtime environments on the same system.

To display the current value of your CLASSPATH environment variable, type the following command at a shell prompt:

      echo $CLASSPATH

If you develop and run applications that use different runtime environments, including other versions that you have installed separately, you must set the CLASSPATH and PATH explicitly for each application. If you run multiple applications simultaneously and use different runtime environments, each application must run in its own shell prompt.

### Updating your SDK or JRE for daylight saving time changes

You can apply recent changes to daylight saving time using the IBM Time Zone Update Utility for Java (JTZU).

#### About this task

Many countries around the world use a daylight saving time (DST) convention. Typically, clocks move forward by one hour during the summer months to create more daylight hours during the afternoon and less during the morning. This practice has many implications, including the need to adjust system clocks in computer systems. Occasionally, countries change their DST start and end dates. These changes can affect the date and time functions in applications, because the original start and end dates are programmed into the operating system and in Java software. To avoid this problem you must update operating systems and Java installations with the new DST information.

The Olson time zone database is an external resource that compiles information about the time zones around the world. This database establishes standard names for time zones, such as "America/New_York", and provides regular updates to time zone information that can be used as reference data. To ensure that Java JREs and SDKs contain up to date DST information, IBM incorporates the latest Olson update into each Java service refresh. To find out which Olson time zone update is included for a particular service refresh, see https://www.ibm.com/developerworks/java/jdk/dst/olson_table.html.

If a DST change has been introduced since the last service refresh, you can use JTZU to directly update your Java installation. You can also use this tool to update your installation if you are unable to move straight to the latest service refresh. JTZU is available from IBM developerWorks® using the following link: https://www.ibm.com/developerworks/java/jdk/dst/jtzu.html.

#### Results

After updating your Java installation with any recent DST changes, your application can handle time and date calculations correctly.

## Uninstalling the SDK and Runtime Environment for Linux

The process that you use to remove the SDK and Runtime Environment for Linux depends on what type of installation you used.

See Uninstalling the Red Hat Package Manager (RPM) package or Uninstalling the compressed Tape Archive (TAR) package for instructions.

### Uninstalling the Red Hat Package Manager (RPM) package

A procedure for uninstalling the Red Hat Package Manager (RPM) package.

#### About this task

To uninstall the SDK or Runtime Environment for Linux if you installed the installable RPM package:

#### Procedure

1. To check which RPM packages you have installed, enter: `rpm -qa | grep -i java`

   You will see a list of any IBM Java packages that you have installed; for example:

       ibm-java2-<arch>-jre-5.0-10.0.<arch>
       ibm-java2-<arch>-sdk-5.0-10.0.<arch>

   This output tells you which packages you can uninstall, using the `rpm -e` command; for example:

       rpm -e ibm-java2-<arch>-jre-5.0-10.0.<arch>
       rpm -e ibm-java2-<arch>-sdk-5.0-10.0.<arch>

   Alternatively, you can use a graphical tool such as kpackage or yast2

2. Remove from your PATH statement the directory in which you installed the SDK and Runtime Environment.
3. (Linux IA 32-bit and PPC32 only) If you installed the Java Plug-in, remove the Java Plug-in files from the Web browser directory.

### Uninstalling the compressed Tape Archive (TAR) package

A list of the steps to remove the IBM SDK for Linux, v5.0 that was extracted from the compressed package.

#### Procedure

1. Remove the SDK or Runtime Environment files from the directory in which you installed the SDK or Runtime Environment.
2. Remove from your PATH statement the directory in which you installed the SDK or Runtime Environment.
3. Log on again or run the updated shell script to activate the new PATH setting.
4. (Linux IA 32-bit and PPC32 only) If you installed the Java Plug-in, remove the Java Plug-in files from the Web browser directory.

# Running Java applications

Java applications can be started using the java launcher or through JNI. Settings are passed to a Java application using command-line arguments, environment variables, and properties files.

## The java and javaw commands

An overview of the java and javaw commands.

### Purpose

The java and javaw tools start a Java application by starting a Java Runtime Environment and loading a specified class.

The javaw command is identical to java, except that javaw has no associated console window. Use javaw when you do not want a command prompt window to be displayed. The javaw launcher displays a window with error information if it fails.

### Usage

The JVM searches for the initial class (and other classes that are used) in three sets of locations: the bootstrap class path, the installed extensions, and the user class path. The arguments that you specify after the class name or jar file name are passed to the main function.

The java and javaw commands have the following syntax:

    java [ options ] <class> [ arguments ... ]
    java [ options ] -jar <file.jar> [ arguments ... ]
    javaw [ options ] <class> [ arguments ... ]
    javaw [ options ] -jar <file.jar> [ arguments ... ]

### Parameters

[options]
  Command-line options to be passed to the runtime environment.
<class>
  Startup class. The class must contain a main() method.
<file.jar>
  Name of the jar file to start. It is used only with the -jar option. The named jar file must contain class and resource files for the application, with the startup class indicated by the Main-Class manifest header.
[arguments ...]
  Command-line arguments to be passed to the main() function of the startup class.

### Obtaining version information

You obtain The IBM build and version number for your Java installation using the -version option.

#### Procedure

1. Open a shell prompt.
2. Type the following command:

       java -version

   You will see information similar to:

       java version "1.5.0"
       Java(TM) 2 Runtime Environment, Standard Edition (build pxi32dev-20051104)
       IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20051103 (JIT enabled)
       J9VM - 20051027_03723_lHdSMR
       JIT  - 20051027_1437_r8
       GC   - 20051020_AA)
       JCL  - 20051102

   Exact build dates and versions will change.

### Specifying Java options and system properties

You can specify Java options and system properties on the command line, by using an options file, or by using an environment variable.

#### About this task

These methods of specifying Java options are listed in order of precedence. Rightmost options on the command line have precedence over leftmost options; for example, if you specify:

    java -Xint -Xjit myClass

The -Xjit option takes precedence.

#### Procedure

1. By specifying the option or property on the command line. For example:

       java -Dmysysprop1=tcpip -Dmysysprop2=wait -Xdisablejavadump MyJavaClass

2. By creating a file that contains the options, and specifying it on the command line using -Xoptionsfile=<file>.
3. By creating an environment variable called IBM_JAVA_OPTIONS containing the options. For example:

       export IBM_JAVA_OPTIONS="-Dmysysprop1=tcpip -Dmysysprop2=wait -Xdisablejavadump"

### Standard options

The definitions for the standard options.

See JVM command-line options for information about nonstandard (-X) options.

-agentlib:<libname>[=<options>]
  Loads a native agent library <libname>; for example -agentlib:hprof. For more information, specify -agentlib:jdwp=help and -agentlib:hprof=help on the command line.
-agentpath:libname[=<options>]
  Loads a native agent library by full path name.
-assert
  Prints help on assert-related options.
-cp <directories and .zip or .jar files separated by :>
  Sets the search path for application classes and resources. If -classpath and -cp are not used and the CLASSPATH environment variable is not set, the user class path is, by default, the current directory (.).
-classpath <directories and .zip or .jar files separated by :>
  Sets the search path for application classes and resources. If -classpath and -cp are not used and the CLASSPATH environment variable is not set, the user class path is, by default, the current directory (.).
-D<property name>=<value>
  Sets a system property.
-help or -?
  Prints a usage message.
-javaagent:<jarpath>[=<options>]
  Load a Java programming language agent. For more information, see the java.lang.instrument API documentation.
-jre-restrict-search
  Include user private JREs in the version search.
-no-jre-restrict-search
  Exclude user private JREs in the version search.
-showversion
  Prints product version and continues.
-verbose:<option>[,<option>...]
  Enables verbose output. Separate multiple options using commas. The available options are:
  class
    Writes an entry to stderr for each class that is loaded.
  gc
    Writes verbose garbage collection information to stderr. Use -Xverbosegclog (see Garbage Collector command-line options for more information) to control the output. See the Diagnostics Guide for more information.
  jni
    Writes information to stderr describing the JNI services called by the application and JVM.
  sizes
    Writes information to stderr describing the active memory usage settings.
  stack
    Writes information to stderr describing the Java and C stack usage for each thread.
-version
  Prints product version.
-version:<value>
  Requires the specified version to run, for example "1.5".
-X
  Prints help on nonstandard options.

### Globalization of the java command

The java and javaw launchers accept arguments and class names containing any character that is in the character set of the current locale. You can also specify any Unicode character in the class name and arguments by using Java escape sequences.

To do this, use the -Xargencoding command-line option.

-Xargencoding
  Use argument encoding. To specify a Unicode character, use escape sequences in the form `\u####`, where # is a hexadecimal digit (0 to 9, A to F).
-Xargencoding:utf8
  Use UTF8 encoding.
-Xargencoding:latin
  Use ISO8859_1 encoding.

For example, to specify a class called HelloWorld using Unicode encoding for both capital letters, use this command:

    java -Xargencoding '\u0048ello\u0057orld'

The java and javaw commands provide translated messages. These messages differ based on the locale in which Java is running. The detailed error descriptions and other debug information that is returned by java is in English.

## The Just-In-Time (JIT) compiler

The IBM Just-In-Time (JIT) compiler dynamically generates machine code for frequently used bytecode sequences in Java applications and applets during their execution. The JIT v5.0 compiler delivers new optimizations as a result of compiler research, improves optimizations implemented in previous versions of the JIT, and provides better hardware exploitation.

The JIT is included in both the IBM SDK and Runtime Environment, which is enabled by default in user applications and SDK tools. Typically, you do not start the JIT explicitly; the compilation of Java bytecode to machine code occurs transparently. You can disable the JIT to help isolate a problem. If a problem occurs when executing a Java application or an applet, you can disable the JIT to help isolate the problem. Disabling the JIT is a temporary measure only; the JIT is required to optimize performance.

For more information about the JIT, see the Diagnostics Guide.

### Disabling the JIT

The JIT can be disabled in a number of different ways. Both command-line options override the JAVA_COMPILER environment variable.

#### About this task

Turning off the JIT is a temporary measure that can help isolate problems when debugging Java applications.

#### Procedure

- Set the JAVA_COMPILER environment variable to `NONE` or the empty string before running the java application. Type the following at a shell prompt:

      export JAVA_COMPILER=NONE

- Use the -D option on the JVM command line to set the java.compiler property to `NONE` or the empty string. Type the following at a shell prompt:

      java -Djava.compiler=NONE <class>

- Use the -Xint option on the JVM command line. Type the following at a shell prompt:

      java -Xint <class>

### Enabling the JIT

The JIT is enabled by default. You can explicitly enable the JIT in a number of different ways. Both command-line options override the JAVA_COMPILER environment variable.

#### Procedure

- Set the JAVA_COMPILER environment variable to `jitc` before running the Java application. At a shell prompt, enter:

      export JAVA_COMPILER=jitc

  If the JAVA_COMPILER environment variable is an empty string, the JIT remains disabled. To disable the environment variable, at the prompt, enter:

      unset JAVA_COMPILER

- Use the -D option on the JVM command line to set the java.compiler property to `jitc`. At a prompt, enter:

      java -Djava.compiler=jitc <class>

- Use the -Xjit option on the JVM command line. Do not specify the -Xint option at the same time. At a prompt, enter:

      java -Xjit <class>

### Determining whether the JIT is enabled

You can determine the status of the JIT using the -version option.

#### Procedure

Run the java launcher with the -version option. Enter the following at a shell prompt:

    java -version

If the JIT is not in use, a message is displayed that includes the following:

    (JIT disabled)

If the JIT is in use, a message is displayed that includes the following:

    (JIT enabled)

#### What to do next

For more information about the JIT, see the Diagnostics Guide.

## Specifying garbage collection policy

The Garbage Collector manages the memory used by Java and by applications running in the JVM.

When the Garbage Collector receives a request for storage, unused memory in the heap is set aside in a process called "allocation". The Garbage Collector also checks for areas of memory that are no longer referenced, and releases them for reuse. This is known as "collection".

The collection phase can be triggered by a memory allocation fault, which occurs when no space is left for a storage request, or by an explicit System.gc() call.

Garbage collection can significantly affect application performance, so the IBM virtual machine provides various methods of optimizing the way garbage collection is carried out, potentially reducing the effect on your application.

For more detailed information about garbage collection, see the Diagnostics Guide.

### Garbage collection options

The -Xgcpolicy options control the behavior of the Garbage Collector. They make trade-offs between throughput of the application and overall system, and the pause times that are caused by garbage collection.

The format of the option and its values is:

-Xgcpolicy:optthruput
  (Default and recommended value.) Delivers very high throughput to applications, but at the cost of occasional pauses.
-Xgcpolicy:optavgpause
  Reduces the time spent in garbage collection pauses and limits the effect of increasing heap size on the length of the garbage collection pause. Use optavgpause if your configuration has a very large heap.
-Xgcpolicy:gencon
  Requests the combined use of concurrent and generational GC to help minimize the time that is spent in any garbage collection pause.
-Xgcpolicy:subpool
  (PPC and zSeries only.) Uses an improved object allocation algorithm to achieve better performance when allocating objects on the heap. This option might improve performance on large SMP systems.

### Pause time

When an application's attempt to create an object cannot be satisfied immediately from the available space in the heap, the Garbage Collector is responsible for identifying unreferenced objects (garbage), deleting them, and returning the heap to a state in which the immediate and subsequent allocation requests can be satisfied quickly.

Such garbage collection cycles introduce occasional unexpected pauses in the execution of application code. Because applications grow in size and complexity, and heaps become correspondingly larger, this garbage collection pause time tends to grow in size and significance.

The default garbage collection value, -Xgcpolicy:optthruput, delivers very high throughput to applications, but at the cost of these occasional pauses, which can vary from a few milliseconds to many seconds, depending on the size of the heap and the quantity of garbage.

### Pause time reduction

The JVM uses two techniques to reduce pause times: concurrent garbage collection and generational garbage collection.

The -Xgcpolicy:optavgpause command-line option requests the use of concurrent garbage collection to reduce significantly the time that is spent in garbage collection pauses. Concurrent GC reduces the pause time by performing some garbage collection activities concurrently with normal program execution to minimize the disruption caused by the collection of the heap. The -Xgcpolicy:optavgpause option also limits the effect of increasing the heap size on the length of the garbage collection pause. The -Xgcpolicy:optavgpause option is most useful for configurations that have large heaps. With the reduced pause time, you might experience some reduction of throughput to your applications.

During concurrent garbage collection, a significant amount of time is wasted identifying relatively long-lasting objects that cannot then be collected. If garbage collection concentrates on only the objects that are most likely to be recyclable, you can further reduce pause times for some applications. Generational GC reduces pause times by dividing the heap into two generations: the "new" and the "tenure" areas. Objects are placed in one of these areas depending on their age. The new area is the smaller of the two and contains new objects; the tenure is larger and contains older objects. Objects are first allocated to the new area; if they have active references for long enough, they are promoted to the tenure area.

Generational GC depends on most objects not lasting long. Generational GC reduces pause times by concentrating the effort to reclaim storage on the new area because it has the most recyclable space. Rather than occasional but lengthy pause times to collect the entire heap, the new area is collected more frequently and, if the new area is small enough, pause times are comparatively short. However, generational GC has the drawback that, over time, the tenure area might become full. To minimize the pause time when this situation occurs, use a combination of concurrent GC and generational GC. The -Xgcpolicy:gencon option requests the combined use of concurrent and generational GC to help minimize the time that is spent in any garbage collection pause.

### Environments with very full heaps

If the Java heap becomes nearly full, and very little garbage can be reclaimed, requests for new objects might not be satisfied quickly because no space is immediately available.

If the heap is operated at near-full capacity, application performance might suffer regardless of which garbage collection options are used; and, if requests for more heap space continue to be made, the application might receive an OutOfMemoryError, which results in JVM termination if the exception is not caught and handled. At this point, the JVM produces a Javadump file for use during diagnostics. In these conditions, you are recommended either to increase the heap size by using the -Xmx option or to reduce the number of objects in use.

For more information, see the Diagnostics Guide.

## Working with floating stacks

Particular Linux distributions, for example Red Hat, have enabled a GLIBC feature called "floating stacks".

Because of Linux kernel limitations, the JVM does not run on SMP hardware with floating stacks enabled if the kernel level is less than 2.4.10. In this environment, floating stacks must be disabled before the JVM, or any application that starts the JVM, is started. On Red Hat, use this command to disable floating stacks by exporting an environment variable:

    export LD_ASSUME_KERNEL=2.2.5

On a non-floating stack Linux system, regardless of what is set for -Xss, a minimum native stack size of 256 KB for each thread is provided. On a floating stack Linux system, the -Xss values are honored. Therefore, if you are migrating from a non-floating stack Linux system, you must ensure that any -Xss values are large enough and are not relying on a minimum of 256 KB.

## Euro symbol support

The IBM SDK and Runtime Environment set the Euro as the default currency for those countries in the European Monetary Union (EMU) for dates on or after 1 January, 2002. From 1 January 2008, Cyprus and Malta also have the Euro as the default currency.

To use the old national currency, specify -Duser.variant=PREEURO on the Java command line.

If you are running the UK, Danish, or Swedish locales and want to use the Euro, specify -Duser.variant=EURO on the Java command line.

## Support for Serbian locale

From Service Refresh 5, the following new locale is added: Serbia (SE), with three new locale variations.

The locale variations are:

- sr_RS
- sr_Cyrl_RS
- sr_Latn_RS

The existing locale variations for the former Serbia and Montenegro are maintained as before. The 3-letter country code SRB, corresponding to the 2-letter country code RC, is also added.

## Fallback font configuration files

The Linux fallback font configuration files (`fontconfig.RedHat.bfc` and `fontconfig.SuSE.bfc`) are installed from Version 5.0 Service Refresh 4 onwards to provide font settings suitable for new enterprise Linux distributions that were being developed when Service Refresh 4 was made available.

These files are for your convenience only. Their presence does not imply that the new Linux distribution is a supported platform for the IBM SDK and Runtime Environment for Linux platforms, Java 2 Technology Edition, Version 5.0.

# Developing Java applications

The SDK for Linux contains many tools and libraries required for Java software development.

See Contents of the SDK for details of the tools available.

## Transforming XML documents

The IBM SDK contains the XSLT4J processor and the XML4J parser. With these tools, you can parse and transform XML documents independently from any given XML processing implementation. By using "Factory Finders" to locate the SAXParserFactory, DocumentBuilderFactory and TransformerFactory implementations, your application can swap between different implementations without having to change any code.

### About this task

The IBM SDK contains the XSLT4J processor and the XML4J parser that conform to the JAXP 1.3 specification.

The XML technology included with the IBM SDK is similar to Apache Xerces Java and Apache Xalan Java. See http://xml.apache.org/xerces2-j/ and http://xml.apache.org/xalan-j/ for more information.

With the XSLT4J processor, you choose between the original XSLT Interpretive processor and the XSLT Compiling processor. The Interpretive processor is for tooling and debugging environments and supports the XSLT extension functions that are not supported by the XSLT Compiling processor. The XSLT Compiling processor is for high performance runtime environments; it generates a transformation engine, or translet, from an XSL style sheet. This approach separates the interpretation of stylesheet instructions from their runtime application to XML data.

The XSLT Interpretive processor is the default processor. To use the XSLT Compiling processor:

- Change the entry in the `jaxp.properties` file, (located in /opt/ibm/java2-<arch>-50/jre/lib) or
- Set the javax.xml.transform.TransformerFactory system property to `org.apache.xalan.xsltc.trax.TransformerFactoryImpl`.

To implement properties in the `jaxp.properties` file, copy `jaxp.properties.sample` to `jaxp.properties` in /opt/ibm/java2-<arch>-50/jre/lib. This file also contains full details about the procedure used to determine which implementations to use for the TransformerFactory, SAXParserFactory, and the DocumentBuilderFactory.

To improve the performance when you transform a StreamSource object with the XSLT Compiling processor, specify the com.ibm.xslt4j.b2b2dtm.XSLTCB2BDTMManager class as the provider of the service org.apache.xalan.xsltc.dom.XSLTCDTMManager. To determine the service provider, try each step until you find org.apache.xalan.xsltc.dom.XSLTCDTMManager:

1. Check the setting of the system property org.apache.xalan.xsltc.dom.XSLTCDTMManager.
2. Check the value of the property org.apache.xalan.xsltc.dom.XSLTCDTMManager in the file /opt/ibm/java2-<arch>-50/jre/lib/xalan.properties.
3. Check the contents of the file `META-INF/services/org.apache.xalan.xsltc.dom.XSLTCDTMManager` for a class name.
4. Use the default service provider, org.apache.xalan.xsltc.dom.XSLTCDTMManager.

The XSLT Compiling processor detects the service provider for the org.apache.xalan.xsltc.dom.XSLTCDTMManager service when a javax.xml.transform.TransformerFactory object is created. Any javax.xml.transform.Transformer or javax.xml.transform.sax.TransformerHandler objects that are created by using that TransformerFactory object use the same service provider. You can change service providers by modifying one of the settings described above and then creating a new TransformerFactory object.

### Using an older version of Xerces or Xalan

If you are using an older version of Xerces (before 2.0) or Xalan (before 2.3) in the endorsed override, you might get a NullPointerException when you start your application. This exception occurs because these older versions do not handle the `jaxp.properties` file correctly.

#### About this task

To avoid this situation, use one of the following workarounds:

- Upgrade to a newer version of the application that implements the latest Java API for XML Programming (JAXP) specification (https://jaxp.dev.java.net/).
- Remove the `jaxp.properties` file from /opt/ibm/java2-<arch>-50/jre/lib.
- Uncomment the entries in the `jaxp.properties` file in /opt/ibm/java2-<arch>-50/jre/lib.
- Set the system property for javax.xml.parsers.SAXParserFactory, javax.xml.parsers.DocumentBuilderFactory, or javax.xml.transform.TransformerFactory using the -D command-line option.
- Set the system property for javax.xml.parsers.SAXParserFactory, javax.xml.parsers.DocumentBuilderFactory, or javax.xml.transform.TransformerFactory in your application. For an example, see the JAXP 1.3 specification.
- Explicitly set the SAX parser, Document builder, or Transformer factory using the IBM_JAVA_OPTIONS environment variable.

      export IBM_JAVA_OPTIONS=-Djavax.xml.parsers.SAXParserFactory=
        org.apache.xerces.jaxp.SAXParserFactoryImpl

  or

      export IBM_JAVA_OPTIONS=-Djavax.xml.parsers.DocumentBuilderFactory=
        org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

  or

      export IBM_JAVA_OPTIONS=-Djavax.xml.transform.TransformerFactory=
        org.apache.xalan.processor.TransformerFactoryImpl

## Debugging Java applications

To debug Java programs, you can use the Java Debugger (JDB) application or other debuggers that communicate by using the Java Platform Debugger Architecture (JPDA) that is provided by the SDK for the operating system.

More information about problem diagnosis using Java can be found in the Diagnostics Guide.

### Java Debugger (JDB)

The Java Debugger (JDB) is included in the SDK for Linux. The debugger is started with the jdb command; it attaches to the JVM using JPDA.

To debug a Java application:

1. Start the JVM with the following options:

       java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=<port> <class>

   The JVM starts up, but suspends execution before it starts the Java application.
2. In a separate session, you can attach the debugger to the JVM:

       jdb -attach <port>

   The debugger will attach to the JVM, and you can now issue a range of commands to examine and control the Java application; for example, type `run` to allow the Java application to start.

For more information about JDB options, type:

    jdb -help

For more information about JDB commands:

1. Type `jdb`
2. At the jdb prompt, type `help`

You can also use JDB to debug Java applications running on remote workstations. JPDA uses a TCP/IP socket to connect to the remote JVM.

1. Start the JVM with the following options:

       java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=<port> <class>

   The JVM starts up, but suspends execution before it starts the Java application.
2. Attach the debugger to the remote JVM:

       jdb -attach <host>:<port>

The Java Virtual Machine Debugging Interface (JVMDI) is not supported in this release. It has been replaced by the Java Virtual Machine Tool Interface (JVMTI).

For more information about JDB and JPDA and their usage, see these Web sites:

- http://java.sun.com/products/jpda/
- http://java.sun.com/j2se/1.5.0/docs/guide/jpda/
- http://java.sun.com/j2se/1.5.0/docs/guide/jpda/jdb.html

## Determining whether your application is running on a 32-bit or 64-bit JVM

Some Java applications must be able to determine whether they are running on a 32-bit JVM or on a 64-bit JVM. For example, if your application has a native code library, the library must be compiled separately in 32- and 64-bit forms for platforms that support both 32- and 64-bit modes of operation. In this case, your application must load the correct library at runtime, because it is not possible to mix 32- and 64-bit code.

### About this task

The system property com.ibm.vm.bitmode allows applications to determine the mode in which your JVM is running. It returns the following values:

- 32 - the JVM is running in 32-bit mode (31-bit mode for Linux on System z)
- 64 - the JVM is running in 64-bit mode

You can inspect the com.ibm.vm.bitmode property from inside your application code using the call:

    System.getProperty("com.ibm.vm.bitmode");

## How the JVM processes signals

When a signal is raised that is of interest to the JVM, a signal handler is called. This signal handler determines whether it has been called for a Java or non-Java thread.

If the signal is for a Java thread, the JVM takes control of the signal handling. If an application handler for this signal is installed and you did not specify the -Xnosigchain command-line option, the application handler for this signal is called after the JVM has finished processing.

If the signal is for a non-Java thread, and the application that installed the JVM had previously installed its own handler for the signal, control is given to that handler. Otherwise, if the signal is requested by the JVM or Java application, the signal is ignored or the default action is taken.

For exception and error signals, the JVM either:

- Handles the condition and recovers, or
- Enters a controlled shut down sequence where it:
  1. Produces dumps, to describe the JVM state at the point of failure
  2. Calls your application's signal handler for that signal
  3. Calls any application-installed unexpected shut down hook
  4. Performs the necessary JVM cleanup

For information about writing a launcher that specifies the above hooks, see: http://www.ibm.com/developerworks/java/library/i-signalhandling/. This item was written for Java V1.3.1, but still applies to later versions.

For interrupt signals, the JVM also enters a controlled shut down sequence, but this time it is treated as a normal termination that:

1. Calls your application's signal handler for that signal
2. Calls all application shut down hooks
3. Calls any application-installed exit hook
4. Performs the necessary JVM cleanup

The shut down is identical to the shut down initiated by a call to the Java method `System.exit()`.

Other signals that are used by the JVM are for internal control purposes and do not cause it to stop. The only control signal of interest is SIGQUIT, which causes a Javadump to be generated.

### Signals used by the JVM

The types of signals are Exceptions, Errors, Interrupts, and Controls.

Table 1 shows the signals that are used by the JVM. The signals are grouped in the table by type or use, as follows:

Exceptions
  The operating system synchronously raises an appropriate exception signal whenever an unrecoverable condition occurs.
Errors
  The JVM raises a SIGABRT if it detects a condition from which it cannot recover.
Interrupts
  Interrupt signals are raised asynchronously, from outside a JVM process, to request shut down.
Controls
  Other signals that are used by the JVM for control purposes.

Table 1. Signals used by the JVM
Signal Name | Signal type | Description | Disabled by -Xrs
--- | --- | --- | ---
SIGBUS (7) | Exception | Incorrect access to memory (data misalignment) | Yes
SIGSEGV (11) | Exception | Incorrect access to memory (write to inaccessible memory) | Yes
SIGILL (4) | Exception | Illegal instruction (attempt to call an unknown machine instruction) | No
SIGFPE (8) | Exception | Floating point exception (divide by zero) | Yes
SIGABRT (6) | Error | Abnormal termination. The JVM raises this signal whenever it detects a JVM fault. | Yes
SIGINT (2) | Interrupt | Interactive attention (CTRL-C). JVM exits normally. | Yes
SIGTERM (15) | Interrupt | Termination request. JVM will exit normally. | Yes
SIGHUP (1) | Interrupt | Hang up. JVM exits normally. | Yes
SIGQUIT (3) | Control | A quit signal for a terminal. By default, this triggers a Javadump. | Yes
SIGTRAP (5) | Control | Used by the JIT. | Yes
SIGRTMAX (2) | Control | Used by the SDK. | No
SIGCHLD (17) | Control | Used by the SDK for internal control. | No

Note: A number supplied after the signal name is the standard numeric value for that signal.

Use the -Xrs (reduce signal usage) option to prevent the JVM from handling most signals. For more information, see Sun's Java application launcher page.

Signals 1 (SIGHUP), 2 (SIGINT), 4 (SIGILL), 7 (SIGBUS), 8 (SIGFPE), 11 (SIGSEGV), and 15 (SIGTERM) on JVM threads cause the JVM to shut down; therefore, an application signal handler should not attempt to recover from these unless it no longer requires the JVM.

### Linking a native code driver to the signal-chaining library

The Runtime Environment contains signal-chaining. Signal-chaining enables the JVM to interoperate more efficiently with native code that installs its own signal handlers.

#### About this task

Signal-chaining enables an application to link and load the shared library `libjsig.so` before the system libraries. The libjsig.so library ensures that calls such as signal(), sigset(), and sigaction() are intercepted so that their handlers do not replace the JVM's signal handlers. Instead, these calls save the new signal handlers, or "chain" them behind the handlers that are installed by the JVM. Later, when any of these signals are raised and found not to be targeted at the JVM, the preinstalled handlers are invoked.

If you install signal handlers that use sigaction() , some sa_flags are not observed when the JVM uses the signal. These are:

- SA_NOCLDSTOP - This is always unset.
- SA_NOCLDWAIT - This is always unset.
- SA_RESTART - This is always set.

The libjsig.so library also hides JVM signal handlers from the application. Therefore, calls such as signal(), sigset(), and sigaction() that are made after the JVM has started no longer return a reference to the JVM's signal handler, but instead return any handler that was installed before JVM startup.

To use libjsig.so:

- Link it with the application that creates or embeds a JVM:

      gcc -L$JAVA_HOME/bin -ljsig -L$JAVA_HOME/bin/j9vm -ljvm java_application.c

  or
- Use the LD_PRELOAD environment variable:

      export LD_PRELOAD=$JAVA_HOME/bin/libjsig.so; java_application (bash and ksh)

      setenv LD_PRELOAD=$JAVA_HOME/bin/libjsig.so; java_application (csh)

The environment variable JAVA_HOME should be set to the location of the SDK, for example,/opt/ibm/java2-<arch>-50/.

To use libjsig.a:

- Link it with the application that creates or embeds a JVM:

      cc_r -q64 <other compile/link parameter> -L/opt/ibm/java2-<arch>-50/jre/bin -ljsig
      -L/opt/ibm/java2-<arch>-50/jre/bin/j9vm -ljvm java_application.c

  Note: Use `xlc_r` or `xlC_r` in place of `cc_r` if that is how you usually call the compiler or linker.

## Writing JNI applications

Valid Java Native Interface (JNI) version numbers that programs can specify on the JNI_CreateJavaVM() API call are: JNI_VERSION_1_2(0x00010002) and JNI_VERSION_1_4(0x00010004).

Restriction: Version 1.1 of the JNI is not supported.

This version number determines only the level of the JNI to use. The actual level of the JVM that is created is specified by the JSE libraries (that is, v5.0). The JNI level does not affect the language specification that is implemented by the JVM, the class library APIs, or any other area of JVM behavior. For more information, see http://java.sun.com/j2se/1.5.0/docs/guide/jni.

If your application needs two JNI libraries, one built for 32- and the other for 64-bit, use the com.ibm.vm.bitmode system property to determine if you are running with a 32- or 64-bit JVM and choose the appropriate library.

To compile and link a local application with the SDK, use the following command:

    gcc -I/opt/ibm/java2-<arch>-50/include -L/opt/ibm/java2-<arch>-50/jre/bin/j9vm
    -ljvm -ldl -lpthread <JNI program filename>

The -ljvm option specifies that `libjvm.so` is the shared library that implements the JVM. The -lpthread option indicates that you are using native pthread support; if you do not link with the pthread library, a segmentation fault (signal SIGSEGV) might be caused when you run the JNI program.

## Support for thread-level recovery of blocked connectors

Four new IBM-specific SDK classes have been added to the com.ibm.jvm package to support the thread-level recovery of Blocked connectors. The new classes are packaged in `core.jar`.

These classes allow you to unblock threads that have become blocked on networking or synchronization calls. If an application does not use these classes, it must end the whole process, rather than interrupting an individual blocked thread.

The classes are:

public interface InterruptibleContext
  Defines two methods, isBlocked() and unblock(). The other three classes implement InterruptibleContext.
public class InterruptibleLockContext
  A utility class for interrupting synchronization calls.
public class InterruptibleIOContext
  A utility class for interrupting network calls.
public class InterruptibleThread
  A utility class that extends java.lang.Thread, to allow wrapping of interruptible methods. It uses instances of InterruptibleLockContext and InterruptibleIOContext to perform the required isBlocked() and unblock() methods depending on whether a synchronization or networking operation is blocking the thread.

Both InterruptibleLockContext and InterruptibleIOContext work by referencing the current thread. Therefore if you do not use InterruptibleThread, you must provide your own class that extends java.lang.Thread, to use these new classes.

The Javadoc information for these classes is provided with the SDK in the `docs/apidoc.zip` file.

## Configuring large page memory allocation

You can enable large page support, on systems that support it, by starting Java with the -Xlp option.

### About this task

Large page usage is primarily intended to provide performance improvements to applications that allocate a great deal of memory and frequently access that memory. The large page performance improvements are a result of the reduced number of misses in the Translation Lookaside Buffer (TLB). The TLB maps a larger virtual storage area range and thus causes this improvement.

Large page support must be available in the kernel, and enabled, so that Java can use large pages.

To configure large page memory allocation, first ensure that the running kernel supports large pages. Check that the file `/proc/meminfo` contains the following lines:

    HugePages_Total:     <number of pages>
    HugePages_Free:      <number of pages>
    Hugepagesize:        <page size, in kB>

The number of pages available and their sizes vary between distributions.

If large page support is not available in your kernel, these lines are not present in the `/proc/meminfo` file. In this case, you must install a new kernel containing support for large pages.

If large page support is available, but not enabled, `HugePages_Total` has the value 0. In this case, your administrator must enable large page support. Check your operating system manual for more instructions.

For the JVM to use large pages, your system must have an adequate number of contiguous large pages available. If large pages cannot be allocated, even when enough pages are available, possibly the large pages are not contiguous. Configuring the number of large pages at boot up creates them contiguously.

Large page allocations only succeed if the user is a member of the group with its gid stored in `/proc/sys/vm/hugetlb_shm_group`, or if Java is run with root access. See http://devresources.linux-foundation.org/dev/robustmutexes/src/fusyn.hg/Documentation/vm/hugetlbpage.txt for more information.

If a non-root user needs access to large pages, their locked memory limit must be increased. The locked memory limit must be at least as large as the maximum size of the Java heap. The maximum size of the Java heap can be specified using the -Xmx command-line option, or determined by adding -verbose:sizes and inspecting the output for the value `-Xmx`. If pam is not installed, change the locked memory limit using the ulimit command. If pam is installed, change the locked memory limit by adding the following lines to `/etc/security/limits.conf`:

    @<large group name> soft memlock 2097152
    @<large group name> hard memlock 2097152

Where <large group name> is the name of the group with its gid stored in `/proc/sys/vm/hugetlb_shm_group`.

## CORBA support

The Java Platform, Standard Edition (J2SE) supports, at a minimum, the specifications that are defined in the compliance document from Sun. In some cases, the IBM J2SE ORB supports more recent versions of the specifications.

The minimum specifications supported are defined in the Official Specifications for CORBA support in J2SE: http://java.sun.com/j2se/1.5.0/docs/api/org/omg/CORBA/doc-files/compliance.html.

### Support for GIOP 1.2

This SDK supports all versions of GIOP, as defined by chapters 13 and 15 of the CORBA 2.3.1 specification, OMG document formal/99-10-07.

http://www.omg.org/cgi-bin/doc?formal/99-10-07

Bidirectional GIOP is not supported.

### Support for Portable Interceptors

This SDK supports Portable Interceptors, as defined by the OMG in the document ptc/01-03-04, which you can obtain from:

http://www.omg.org/cgi-bin/doc?ptc/01-03-04

Portable Interceptors are hooks into the ORB that ORB services can use to intercept the normal flow of execution of the ORB.

### Support for Interoperable Naming Service

This SDK supports the Interoperable Naming Service, as defined by the OMG in the document ptc/00-08-07, which you can obtain from:

http://www.omg.org/cgi-bin/doc?ptc/00-08-07

The default port that is used by the Transient Name Server (the tnameserv command), when no ORBInitialPort parameter is given, has changed from 900 to 2809, which is the port number that is registered with the IANA (Internet Assigned Number Authority) for a CORBA Naming Service. Programs that depend on this default might have to be updated to work with this version.

The initial context that is returned from the Transient Name Server is now an org.omg.CosNaming.NamingContextExt. Existing programs that narrow the reference to a context org.omg.CosNaming.NamingContext still work, and do not need to be recompiled.

The ORB supports the -ORBInitRef and -ORBDefaultInitRef parameters that are defined by the Interoperable Naming Service specification, and the ORB::string_to_object operation now supports the ObjectURL string formats (corbaloc: and corbaname:) that are defined by the Interoperable Naming Service specification.

The OMG specifies a method ORB::register_initial_reference to register a service with the Interoperable Naming Service. However, this method is not available in the Sun Java Core API at Version 5.0. Programs that have to register a service in the current version must invoke this method on the IBM internal ORB implementation class. For example, to register a service "MyService":

    ((com.ibm.CORBA.iiop.ORB)orb).register_initial_reference("MyService",
    serviceRef);

Where `orb` is an instance of org.omg.CORBA.ORB, which is returned from ORB.init(), and `serviceRef` is a CORBA Object, which is connected to the ORB. This mechanism is an interim one, and is not compatible with future versions or portable to non-IBM ORBs.

### System properties for tracing the ORB

A runtime debug feature provides improved serviceability. You might find it useful for problem diagnosis or it might be requested by IBM service personnel.

#### Tracing Properties

com.ibm.CORBA.Debug=true
  Turns on ORB tracing.
com.ibm.CORBA.CommTrace=true
  Adds GIOP messages (sent and received) to the trace.
com.ibm.CORBA.Debug.Output=<file>
  Specify the trace output file. By default, this is of the form `orbtrc.DDMMYYYY.HHmm.SS.txt`.

#### Example of ORB tracing

For example, to trace events and formatted GIOP messages from the command line, type:

    java -Dcom.ibm.CORBA.Debug=true
         -Dcom.ibm.CORBA.CommTrace=true <myapp>

#### Limitations

Do not enable tracing for normal operation, because it might cause performance degradation. Even if you have switched off tracing, FFDC (First Failure Data Capture) is still working, so serious errors are reported. If a debug output file is generated, examine it to check on the problem. For example, the server might have stopped without performing an ORB.shutdown().

The content and format of the trace output might vary from version to version.

### System properties for tuning the ORB

The ORB can be tuned to work well with your specific network. The properties required to tune the ORB are described here.

com.ibm.CORBA.FragmentSize=<size in bytes>
  Used to control GIOP 1.2 fragmentation. The default size is 1024 bytes.

  To disable fragmentation, set the fragment size to 0 bytes:

      java -Dcom.ibm.CORBA.FragmentSize=0 <myapp>

com.ibm.CORBA.RequestTimeout=<time in seconds>
  Sets the maximum time to wait for a CORBA Request. By default the ORB waits indefinitely. Do not set the timeout too low to avoid connections ending unnecessarily.
com.ibm.CORBA.LocateRequestTimeout=<time in seconds>
  Set the maximum time to wait for a CORBA LocateRequest. By default the ORB waits indefinitely.
com.ibm.CORBA.ListenerPort=<port number>
  Set the port for the ORB to read incoming requests on. If this property is set, the ORB starts listening as soon as it is initialized. Otherwise, it starts listening only when required.

### Java security permissions for the ORB

When running with a Java SecurityManager, invocation of some methods in the CORBA API classes might cause permission checks to be made, which might result in a SecurityException. If your program uses any of these methods, ensure that it is granted the necessary permissions.

Table 2. Methods affected when running with Java SecurityManager
Class/Interface | Method | Required permission
--- | --- | ---
org.omg.CORBA.ORB | init | java.net.SocketPermission resolve
org.omg.CORBA.ORB | connect | java.net.SocketPermission listen
org.omg.CORBA.ORB | resolve_initial_references | java.net.SocketPermission connect
org.omg.CORBA. portable.ObjectImpl | _is_a | java.net.SocketPermission connect
org.omg.CORBA. portable.ObjectImpl | _non_existent | java.net.SocketPermission connect
org.omg.CORBA. portable.ObjectImpl | OutputStream _request (String, boolean) | java.net.SocketPermission connect
org.omg.CORBA. portable.ObjectImpl | _get_interface_def | java.net.SocketPermission connect
org.omg.CORBA. Request | invoke | java.net.SocketPermission connect
org.omg.CORBA. Request | send_deferred | java.net.SocketPermission connect
org.omg.CORBA. Request | send_oneway | java.net.SocketPermission connect
javax.rmi. PortableRemoteObject | narrow | java.net.SocketPermission connect

### ORB implementation classes

A list of the ORB implementation classes.

The ORB implementation classes in this release are:

- org.omg.CORBA.ORBClass=com.ibm.CORBA.iiop.ORB
- org.omg.CORBA.ORBSingletonClass=com.ibm.rmi.corba.ORBSingleton
- javax.rmi.CORBA.UtilClass=com.ibm.CORBA.iiop.UtilDelegateImpl
- javax.rmi.CORBA.StubClass=com.ibm.rmi.javax.rmi.CORBA.StubDelegateImpl
- javax.rmi.CORBA.PortableRemoteObjectClass=com.ibm.rmi.javax.rmi.PortableRemoteObject

These are the default values, and you are advised not to set these properties or refer to the implementation classes directly. For portability, make references only to the CORBA API classes, and not to the implementation. These values might be changed in future releases.

## RMI over IIOP

Java Remote Method Invocation (RMI) provides a simple mechanism for distributed Java programming. RMI over IIOP (RMI-IIOP) uses the Common Object Request Broker Architecture (CORBA) standard Internet Inter-ORB Protocol (IIOP) to extend the base Java RMI to perform communication. This allows direct interaction with any other CORBA Object Request Brokers (ORBs), whether they were implemented in Java or another programming language.

The following documentation is available:

- The RMI-IIOP Programmer's Guide is an introduction to writing RMI-IIOP programs.
- The demo directory contains:
  - A "Hello World" example that can switch between the Java Remote Method Protocol (JRMP) and IIOP protocols (demo/rmi-iiop/hello)
  - A "Hello World" example that interacts with a standard Interface Description Language (IDL) program (demo/rmi-iiop/idl)
- The Java Language to IDL Mapping document is a detailed technical specification of RMI-IIOP: http://www.omg.org/cgi-bin/doc?ptc/00-01-06.pdf.

## Implementing the Connection Handler Pool for RMI

Thread pooling for RMI Connection Handlers is not enabled by default.

### About this task

To enable the connection pooling implemented at the RMI TCPTransport level, set the option

    -Dsun.rmi.transport.tcp.connectionPool=true

This version of the Runtime Environment does not have a setting that you can use to limit the number of threads in the connection pool.

## Enhanced BigDecimal

From Java 5.0, the IBM BigDecimal class has been adopted by Sun as java.math.BigDecimal. The com.ibm.math.BigDecimal class is reserved for possible future use by IBM and is currently deprecated. Migrate existing Java code to use java.math.BigDecimal.

The new java.math.BigDecimal uses the same methods as both the previous java.math.BigDecimal and com.ibm.math.BigDecimal. Existing code using java.math.BigDecimal continues to work correctly. The two classes do not serialize.

To migrate existing Java code to use the java.math.BigDecimal class, change the import statement at the top of your `.java` file from: `import com.ibm.math.*;` to `import java.math.*;`.

## Support for XToolkit

The IBM SDK for Linux, v5.0 supports XToolkit from Service Refresh 4. You need XToolkit when using the SWT_AWT bridge in Eclipse to build an application that uses both SWT and Swing. XToolkit is an alternative to the existing use of MToolkit libraries, with the benefit of faster rendering.

Restriction: Motif is no longer supported and will be removed in a later release.

Related links:

- An example of integrating Swing into Eclipse RCPs: http://eclipsezone.com/eclipse/forums/t45697.html
- Reference Information in the Eclipse information center: http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/awt/SWT_AWT.html
- Set up information is available on the Sun Microsystems Inc. Web site: http://java.sun.com/j2se/1.5.0/docs/guide/awt/1.5/xawt.html

## Support for the Java Attach API

The Java Attach API allows your application to connect to another virtual machine (the "target"). Your application can then load an agent application into the target virtual machine, for example to perform tasks such as monitoring status.

Code for agent applications, such as JMX agents or JVMTI agents, is normally loaded during virtual machine startup by specifying special startup parameters. Requiring startup parameters might not be convenient for using agents on applications that are already running, such as WebSphere Application Servers. Using the Java Attach API, lets you load an agent at any time by specifying the process ID of the target virtual machine. The Attach API capability is sometimes called the "late attach" capability.

The Attach API is disabled by default for Java 5 SR 11 and later.

### Security considerations

Security for the Java Attach API is handled by UNIX® user and group file permissions.

The Java Attach API creates files and directories in a common directory. The common directory, subdirectories, and files in it, have UNIX file permissions. It is recommended that you change the ownership of the common directory to ROOT or another privileged user ID, to prevent 'spoofing' attacks.

The key security features of the Java Attach API are:

- For Java 5 SR 11 and later, a process using the Java Attach API must be owned by the same UNIX userid as the target process. This constraint ensures that only the target process owner can attach other applications to the target process.
- For Java 5 SR 11 and later, access to the files or directories owned by a process is controlled by user permissions only; group access (read/write) is disabled.
- The common directory uses the sticky bit to prevent a user from deleting or replacing a subdirectory belonging to another user. To preserve the security of this mechanism, set the ownership of the common directory to ROOT.
- The subdirectory for a process is accessible only by members of the same UNIX group as the owner of a process. For Java 5 SR 11 and later, read/write access is restricted to the owner only, except for the `attachNotificationSync` file. The `attachNotificationSync` file can be written to by all users. This exception does not affect security because the file is used exclusively for synchronization and is never written to or read.
- Information about the target process can be written only by the owner, and read only by the owner or a member of the same group as the owner. For Java 5 SR 11 and later, read/write access is restricted to the owner only.

You must secure access to the Java Attach API capability to ensure that only authorized users or processes can connect to another virtual machine. If you do not intend to use the Java Attach API capability, disable this feature using the Java system property. Set the com.ibm.tools.attach.enable system property to the value no; for example:

    -Dcom.ibm.tools.attach.enable=no

### Using the Java Attach API

By default, the target virtual machine is identified by its process ID. To use a different target, change the system property com.ibm.tools.attach.id; for example:

    -Dcom.ibm.tools.attach.id=<process_ID>

The target process also has a human-readable "display name". By default, the display name is the process ID. To change the default display name, use the com.ibm.tools.attach.displayName system property. The ID and display name cannot be changed after the application has started.

The Attach API creates working files in a common directory called `.com_ibm_tools_attach`, which is created in the system temporary directory. The system property java.io.tmpdir holds the value of the system temporary directory. On non-Windows® systems, the system temporary directory is typically `/tmp`. To modify the working directory, use the Java system property com.ibm.tools.attach.directory; for example:

    -Dcom.ibm.tools.attach.directory=/working

If your Java application ends abnormally, for example, following a crash or a SIGKILL signal, the process subdirectory is not deleted. The Java VM detects and removes obsolete subdirectories where possible. The subdirectory can also be deleted by the owning userid.

On heavily loaded system, applications might experience timeouts when attempting to connect to target applications. The default timeout is 120 seconds. Use the com.ibm.tools.attach.timeout system property to specify a different timeout value in seconds. For example, to timeout after 60 seconds:

    -Dcom.ibm.tools.attach.timeout=60

A timeout value of zero indicates an indefinite wait.

For JMX applications, you might need to disable authentication by editing the `<JAVA_HOME>/jre/lib/management/management.properties` file. Set the following properties to disable authentication in JMX:

    com.sun.management.jmxremote.authenticate=false
    com.sun.management.jmxremote.ssl=false

An unsuccessful attempt to invoke the Attach API results in one of the following exceptions:

- `com.ibm.tools.attach.AgentLoadException`
- `com.ibm.tools.attach.AgentInitializationException`
- `com.ibm.tools.attach.AgentNotSupportedException`
- `java.io.IOException`

A useful reference for information about the Attach API can be found at http://java.sun.com/javase/6/docs/technotes/guides/attach/index.html. The IBM implementation of the Attach API corresponds approximately to the Sun Microsystems, Inc. implementation. However, if your application originally used com.sun.tools.attach.* methods or classes, you must modify and recompile the application to use the com.ibm.tools.attach.* implementation.

Note: The IBM SDK for Java 5.0 implements a subset of the Attach API. In particular, the two methods

    public void loadAgent(String agent)
    public void loadAgent(String agent, String options)

are not available.

# Plug-in, Applet Viewer and Web Start

The Java plug-in is used to run Java applications in the browser. The appletviewer is used to test applications designed to be run in a browser. Java Web Start is used to deploy desktop Java applications over a network, and provides a mechanism for keeping them up-to-date.

## (Linux IA 32-bit and PPC32 only) Using the Java plug-in

The Java plug-in is a Web browser plug-in. You use the Java plug-in to run applets in the browser.

You must allow applets to finish loading to prevent your browser from stopping. For example, if you use the Back button and then the Forward button while an applet is loading, the HTML pages might be unable to load.

The Java plug-in is documented by Sun at: http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/.

### Supported browsers

The Java plug-in supports Mozilla, and Mozilla Firefox.

Table 3. Browsers supported by the Java plug-in on Linux IA32
Browser | Supported versions
--- | ---
Firefox | 2.0, 3.0, 3.5

Table 4. Browsers supported by the Java plug-in on Linux PPC32
Browser | Supported Versions
--- | ---
Mozilla | 1.6

Later minor releases of these browsers are also supported.

### Installing the Java plug-in

To install the Java plug-in, symbolically link it to the plug-in directory for your browser.

The Java plug-in is based on Mozilla's Open JVM Integration initiative, which is used with most Mozilla products and derivatives, including Firefox.

You must symbolically link the plug-in, rather than copy it, so that the browser and plug-in can locate the JVM.

#### Mozilla

Symbolically link the Java plug-in to the plug-ins directory for the Mozilla Web browser. Use the "about" information in Mozilla to verify the Java plug-in is correctly installed.

##### Before you begin

Only Mozilla versions 1.4 and later are supported.

To install the plug-in on Mozilla:

##### Procedure

1. Log in as root.
2. Change to your Mozilla plug-ins directory (which differs, depending on the Linux distributions).
   - To make the plug-in available to all users:

          cd /usr/local/mozilla/plugins/

   - To make the plug-in available to the current user only:

         cd $HOME/.mozilla/plugins

3. Create a symbolic link to the plug-in.
   Note: Use the library `libjavaplugin_ojigtk2.so` on SLES11.

        ln -s /opt/ibm/java2-<arch>-50/jre/bin/libjavaplugin_oji.so .

##### Results

To verify that the Java plug-in is available and enabled, select Help -> About plug-ins in Mozilla.

##### What to do next

You must symbolically link the plug-in, rather than copy it, so that it can locate the JVM.

Restriction: You can have only one Java plug-in shared library in `/usr/local/mozilla/plugins/`. Mozilla attempts to load anything that is in that directory, (or subdirectories underneath it), as a plug-in, and results are unpredictable if two versions of the Java plug-in are loaded.

#### Firefox

These steps make the Java plug-in available to Mozilla Firefox users.

##### Procedure

1. Log in as root.
2. Change to your Firefox plug-ins directory (which differs, depending on the Linux distributions).

       cd /usr/local/mozilla-firefox/plugins/

3. Create a symbolic link to the plug-in.
   Note: Use the library `libjavaplugin_ojigtk2.so` on SLES11.
   - To link to the GTK1.x plug-in:

          ln -s /opt/ibm/java2-<arch>-50/jre/bin/libjavaplugin_oji.so .

   - To link to the GTK2 plug-in:

          ln -s /opt/ibm/java2-<arch>-50/jre/bin/libjavaplugin_ojigtk2.so .

##### What to do next

You must symbolically link the plug-in, rather than copy it, so that it can locate the JVM.

### Common Document Object Model (DOM) support

Because of limitations in particular browsers, you might not be able to implement all the functions of the org.w3c.dom.html package.

One of the following errors is thrown:

- sun.plugin.dom.exception.InvalidStateException
- sun.plugin.dom.exception.NotSupportedException

### Using DBCS parameters

The Java plug-in supports double-byte characters (for example, Chinese Traditional BIG-5, Korean, and Japanese) as parameters for the tags <APPLET>, <OBJECT>, and <EMBED>. You must select the correct character encoding for your HTML document so that the Java plug-in can parse the parameter.

#### About this task

Specify character encoding for your HTML document by using the `<META>` tag in the `<HEAD>` section like this:

    <meta http-equiv="Content-Type" content="text/html; charset=big5">

This example tells the browser to use the Chinese BIG-5 character encoding to parse the HTML file.

Some older versions of browsers might not understand this tag correctly. In this case, you can force the browser to ignore this tag, but you might have to change the encoding manually. To manually specify which encoding you want to use to parse the HTML file:

Mozilla Firefox
  View Menu -> Character Coding

## Working with applets

With the Applet Viewer, you can run one or more applets that are called by reference in a Web page (HTML file) by using the <APPLET> tag. The Applet Viewer finds the <APPLET> tags in the HTML file and runs the applets, in separate windows, as specified by the tags.

Because the Applet Viewer is for viewing applets, it cannot display a whole Web page that contains many HTML tags. It parses only the <APPLET> tags and no other HTML on the Web page.

### Running and debugging applets with the Applet Viewer

Use the following commands to run and debug an applet with the Applet Viewer.

#### About this task

Running applets with the Applet Viewer:

From a shell prompt, enter:

       appletviewer <name>

where <name> is one of the following:

- The file name of an HTML file that calls an applet.
- The URL of a Web page that calls an applet.

For example, to start the Applet Viewer on an HTML file that calls an applet, type at a shell prompt:

      appletviewer $HOME/<filename>.html

Where filename is the name of the HTML file.

To start the Applet Viewer on a Web page, type at a shell prompt:

    appletviewer http://java.sun.com/applets/jdk/1.4/demo/applets/NervousText/example1.html

The Applet Viewer does not recognize the charset option of the <

    META

> tag. If the file that the Applet Viewer loads is not encoded as the system default, an I/O exception might occur. To avoid the exception, use the -encoding option when you run appletviewer. For example:

    appletviewer -encoding JISAutoDetect sample.html

Debugging applets with the Applet Viewer:

For example:

    cd demo/applets/TicTacToe
    ../../bin/appletviewer -debug example1.html

You can find documentation about how to debug applets using the Applet Viewer at the Sun Web site: http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/debugger.html.

## (Linux IA 32-bit, PPC32, and PPC64 only) Using Web Start

Java Web Start is used for Java application deployment.

With Web Start, you can start and manage applications directly from the Web. Applications are cached to minimize installation times. Applications are automatically upgraded when new versions become available.

Web Start supports these command-line arguments documented at http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html#resources:

- -verbose
- -version
- -showversion
- -help
- -X
- -ea
- -enableassertions
- -da
- -disableassertions
- -esa
- -enablesystemassertions
- -dsa
- -disablesystemassertions
- -Xint
- -Xnoclassgc
- -Xdebug
- -Xfuture
- -Xrs
- -Xms
- -Xmx
- -Xss

Web Start also supports -Xgcpolicy to set the garbage collection policy.

Web Start applications can request to be run with a specific JVM. When running Web Start applications that request a 1.4.2 JVM using the Java 5.0 version of Web Start, the Java console will not be shown, regardless of the Java Console setting in the Java Control Panel.For information about the browsers that support Web Start, see Supported browsers.

For more information about Web Start, see:

- http://java.sun.com/products/javawebstart and

- http://java.sun.com/j2se/1.5.0/docs/guide/javaws/index.html.

For more information about deploying applications, see:

- http://java.sun.com/j2se/1.5.0/docs/guide/deployment/index.html.

### Running Web Start

Web Start can be run from a Web page or the command line. Web Start applications are stored in the Java Application Cache.

#### Before you begin

Java Web Start Version 5.0 is installed automatically when you install Java using the `.rpm` or `.tgz` packages. If you extract Java from the `.tgz` package, run the `jre/lib/javaws/updateSettings.sh` shell script, to update the `.mailcap` and `.mime.types` files on your system.

#### About this task

You can start Web Start in a number of different ways.

#### Procedure

- Select a link on a Web page that refers to a `.jnlp` file. If your browser does not have the correct association to run Web Start applications, select the `/opt/ibm/java2-<arch>-50/jre/bin/javaws` command from the Open/Save window to start the Web Start application.
- At a shell prompt, type:

      javaws <URL>

  Where <URL> is the location of a `.jnlp` file.
- If you have used Java Web Start to open the application in the past, use the Java Application Cache Viewer. At a shell prompt, type:

      /opt/ibm/java2-<arch>-50/jre/bin/javaws

  All Java Web Start applications are stored in the Java Application Cache. An application is downloaded only if the latest version is not in the cache.

### (Linux IA 32-bit only) WebStart Secure Static Versioning

Static versioning allows Web Start applications to request a specific JVM version on which those applications will run. Because static versioning also allows applications to exploit old security vulnerabilities on systems that have been upgraded to a new JVM, Secure Static Versioning (SSV) is now used by default.

With SSV, the user is warned before running any unsigned Web Start application that requests a specific JVM, if the requested JVM is installed. Signed applications and applications that request the latest version of the JVM run as usual.

You can disable SSV by setting the deployment.javaws.ssv.enabled property in the `deployment.properties` file to false.

## Distributing Java applications

Java applications typically consist of class, resource, and data files.

When you distribute a Java application, your software package probably consists of the following parts:

- Your own class, resource, and data files
- An installation procedure or program

To run your application, a user needs the Runtime Environment for Linux. The SDK for Linux software contains a Runtime Environment. However, you cannot assume that your users have the SDK for Linux software installed.

Your SDK for Linux software license does not allow you to redistribute any of the SDK's files with your application. You must ensure that a licensed version of the SDK for Linux is installed on the target workstation.

# Class data sharing between JVMs

Class data sharing enables multiple JVMs to share a single space in memory.

You can share data between Java Virtual Machines (JVMs) by storing it in a cache in shared memory. Sharing reduces the overall virtual storage consumption when more than one JVM shares a cache. Sharing also reduces the startup time for a JVM after the cache has been created. The shared class cache is independent of any active JVM and persists beyond the lifetime of the JVM that created the cache.

A shared cache can contain:

- Bootstrap classes
- Application classes
- Metadata that describes the classes

## Overview of class data sharing

Class data sharing provides a method of reducing memory footprint and improving JVM start-up time.

### Enabling class data sharing

Enable class data sharing by using the -Xshareclasses option when starting a JVM. The JVM connects to an existing cache or creates a new cache if one does not exist.

All bootstrap and application classes loaded by the JVM are shared by default. Custom classloaders share classes automatically if they extend the application classloader. Otherwise, they must use the Java Helper API provided with the JVM to access the cache. See Adapting custom classloaders to share classes.

### Cache access

Any JVM connected to a cache can update the cache. Any number of JVMs can concurrently read from the cache, even while another JVM is writing to it.

You must take care if runtime bytecode modification is being used. See Runtime bytecode modification for more information.

### Dynamic updating of the cache

The shared class cache persists beyond the lifetime of any JVM. Therefore, the cache is updated dynamically to reflect any modifications that might have been made to JARs or classes on the file system. The dynamic updating makes the cache independent of the application using it.

### Cache security

Access to the shared class cache is limited by operating system permissions and Java security permissions. The shared class cache is created with user access by default unless the groupAccess command-line suboption is used. Only a classloader that has registered to share class data can update the shared class cache.

If a Java SecurityManager is installed, classloaders, excluding the default bootstrap, application, and extension classloaders, must be granted permission to share classes. Grant permission by adding SharedClassPermission lines to the `java.policy` file. See Using SharedClassPermission for more information. The RuntimePermission createClassLoader restricts the creation of new classloaders and therefore also restricts access to the cache.

### Cache lifespan

Multiple caches can exist on a system and you specify them by name as a suboption to the -Xshareclasses command. A JVM can connect to only one cache at any one time.

You can override the default cache size on startup using -Xscmx<n><size>. This size is then fixed for the lifetime of the cache. Caches exist until they are explicitly deleted using a suboption to the -Xshareclasses command or until the system is rebooted.

### Cache utilities

All cache utilities are suboptions to the -Xshareclasses command. See Class data sharing command-line options or use -Xshareclasses:help to see a list of available suboptions.

## Class data sharing command-line options

Class data sharing and the cache management utilities are controlled using command-line options to the Java launcher.

For options that take a <size> parameter, suffix the number with "k" or "K" to indicate kilobytes, "m" or "M" to indicate megabytes, or "g" or "G" to indicate gigabytes.

-Xscmx<size>
  Specifies cache size. This option applies only if a cache is being created and no cache of the same name exists. The default cache size is platform-dependent. You can find out the size value being used by adding -verbose:sizes as a command-line argument. The minimum cache size is 4 KB. The maximum cache size is also platform-dependent. (See Cache size limits.)
-Xshareclasses:<suboption>[,<suboption>...]
  Enables class data sharing. Can take a number of suboptions, some of which are cache utilities. Cache utilities perform the required operation on the specified cache, without starting the VM. You can combine multiple suboptions, separated by commas, but the cache utilities are mutually exclusive. When running cache utilities, the message `Could not create the Java virtual machine` is expected. Cache utilities do not create the virtual machine.

  You can use the following suboptions with the -Xshareclasses option:

  help
    Lists all the command-line suboptions.
  name=<name>
    Connects to a cache of a given name, creating the cache if it does not already exist. Also used to indicate the cache that is to be modified by cache utilities; for example, destroy. Use the listAllCaches utility to show which named caches are currently available. If you do not specify a name, the default name "sharedcc_%u" is used. %u in the cache name inserts the current user name. You can specify "%g" in the cache name to insert the current group name.
  groupAccess
    Sets operating system permissions on a new cache to allow group access to the cache. The default is user access only.
  verbose
    Enables verbose output, which provides overall status on the shared class cache and more detailed error messages.
  verboseIO
    Gives detailed output on the cache I/O activity, listing information on classes being stored and found. Each classloader is given a unique ID (the bootstrap loader is always 0) and the output shows the classloader hierarchy at work, where classloaders must ask their parents for a class before they can load it themselves. It is usual to see many failed requests; this behavior is expected for the classloader hierarchy.
  verboseHelper
    Enables verbose output for the Java Helper API. This output shows you how the Helper API is used by your ClassLoader.
  silent
    Turns off all shared classes messages, including error messages. Unrecoverable error messages, which prevent the JVM from initializing, are displayed.
  nonfatal
    Allows the JVM to start even if class data sharing fails. Normal behavior for the JVM is to refuse to start if class data sharing fails. If you select nonfatal and the shared classes cache fails to initialize, the JVM starts without class data sharing.
  none
    Can be added to the end of a command line to disable class data sharing. This suboption overrides class sharing arguments found earlier on the command line.
  modified=<modified context>
    Used when a JVMTI agent is installed that might modify bytecode at runtime. If you do not specify this suboption and a bytecode modification agent is installed, classes are safely shared with an extra performance cost. The <modified context> is a descriptor chosen by the user; for example, "myModification1". This option partitions the cache, so that only JVMs using context myModification1 can share the same classes. For instance, if you run HelloWorld with a modification context and then run it again with a different modification context, all classes are stored twice in the cache. See Runtime bytecode modification for more information.
  destroy (Utility option)
    Destroys a cache using the name specified in the name=<name> suboption. If the name is not specified, the default cache is destroyed. A cache can be destroyed only if all VMs using it have shut down, and the user has sufficient permissions.
  destroyAll (Utility option)
    Tries to destroy all caches available to the user. A cache can be destroyed only if all VMs using it have shut down, and the user has sufficient permissions.
  expire=<time in minutes>
    Destroys all caches that have been unused for the time specified before loading shared classes. This option is not a utility option because it does not cause the JVM to exit.
  listAllCaches (Utility option)
    Lists all the caches on the system, describing if they are in use and when they were last used.
  printStats (Utility option)
    Displays summary statistics information about the cache specified in the name=<name> suboption. If the name is not specified, statistics are displayed about the default cache. The most useful information displayed is how full the cache is and how many classes it contains. Stale classes are classes that have been updated on the file system and which the cache has therefore marked "stale". Stale classes are not purged from the cache and can be reused. See the Diagnostics Guide for more information.
  printAllStats (Utility option)
    Displays detailed information for the cache specified by the name suboption. Every class is listed in chronological order, with a reference to the location from which it was loaded.

    See the Diagnostics Guide for more information.

## Creating, populating, monitoring, and deleting a cache

An overview of the life-cycle of a shared class data cache including examples of the cache management utilities.

To enable class data sharing, add -Xshareclasses[:name=<name>] to your application command line.

The JVM either connects to an existing cache of the given name or creates a new cache of that name. If a new cache is created, it is populated with all bootstrap and application classes being loaded until the cache becomes full. If two or more JVMs are started concurrently, they populate the cache concurrently.

To check that the cache has been created, run `java -Xshareclasses:listAllCaches`. To see how many classes and how much class data is being shared, run `java -Xshareclasses:[name=<name>],printStats`. You can run these utilities after the application JVM has terminated or in another command window.

For more feedback on cache usage while the JVM is running, use the verbose suboption. For example, `java -Xshareclasses:[name=<name>],verbose`.

To see classes being loaded from the cache or stored in the cache, add `-Xshareclasses:[name=<name>],verboseIO` to your application command line.

To delete the cache, run `java -Xshareclasses:[name=<name>],destroy`. You usually delete caches only if they contain many stale classes or if the cache is full and you want to create a bigger cache.

You should tune the cache size for your specific application, because the default is unlikely to be the optimum size. To determine the optimum cache size, specify a large cache, using -Xscmx, run the application, and then use printStats to determine how much class data has been stored. Add a small amount to the value shown in printStats for contingency. Because classes can be loaded at any time during the lifetime of the JVM, it is best to do this analysis after the application has terminated. However, a full cache does not have a negative affect on the performance or capability of any JVMs connected to it, so it is acceptable to decide on a cache size that is smaller than required.

If a cache becomes full, a message is displayed on the command line of any JVMs using the verbose suboption. All JVMs sharing the full cache then loads any further classes into their own process memory. Classes in a full cache can still be shared, but a full cache is read-only and cannot be updated with new classes.

## Performance and memory consumption

Class data sharing is particularly useful on systems that use more than one JVM running similar code; the system benefits from reduced virtual storage consumption. It is also useful on systems that frequently start and shut down JVMs, which benefit from the improvement in startup time.

The processor and memory usage required to create and populate a new cache is minimal. The JVM startup cost in time for a single JVM is typically between 0 and 5% slower compared with a system not using class data sharing, depending on how many classes are loaded. JVM startup time improvement with a populated cache is typically between 10% and 40% faster compared with a system not using class data sharing, depending on the operating system and the number of classes loaded. Multiple JVMs running concurrently show greater overall startup time benefits.

Duplicate classes are consolidated in the shared class cache. For example, class A loaded from `myClasses.jar` and class A loaded from `myOtherClasses.jar` (with identical content) is stored only once in the cache. The printAllStats utility shows multiple entries for duplicated classes, with each entry pointing to the same class.

When you run your application with class data sharing, you can use the operating system tools to see the reduction in virtual storage consumption.

## Considerations and limitations of using class data sharing

Consider these factors when deploying class data sharing in a product and using class data sharing in a development environment.

### Cache size limits

The maximum theoretical cache size is 2 GB. The size of cache you can specify is limited by the amount of physical memory and paging space available to the system.

The cache for sharing classes is allocated using the System V IPC Shared memory mechanism. Cache size is limited by SHMMAX settings, which limits the amount of shared memory that can be allocated. You can find these settings by looking at the`/proc/sys/kernel/shmmax` file. SHMMAX is typically set to 30 MB.

Because the virtual address space of a process is shared between the shared classes cache and the Java heap, if you increase the maximum size of the Java heap you might reduce the size of the shared classes cache you can create.

### Runtime bytecode modification

Any JVM using a JVM Tool Interface (JVMTI) agent that can modify bytecode data must use the modified=<modified_context> suboption if it wants to share the modified classes with another JVM.

The modified context is a user-specified descriptor that describes the type of modification being performed. The modified context partitions the cache so that all JVMs running under the same context share a partition.

This partitioning allows JVMs that are not using modified bytecode to safely share a cache with those that are using modified bytecode. All JVMs using a given modified context must modify bytecode in a predictable, repeatable manner for each class, so that the modified classes stored in the cache have the expected modifications when they are loaded by another JVM. Any modification must be predictable because classes loaded from the shared class cache cannot be modified again by the agent.

If a JVMTI agent is used without a modification context, classes are still safely shared by the JVM, but with a small affect on performance. Using a modification context with a JVMTI agent avoids the need for extra checks and therefore has no affect on performance. A custom ClassLoader that extends java.net.URLClassLoader and modifies bytecode at load time without using JVMTI automatically stores that modified bytecode in the cache, but the cache does not treat the bytecode as modified. Any other VM sharing that cache loads the modified classes. You can use the modified=<modification_context> suboption in the same way as with JVMTI agents to partition modified bytecode in the cache. If a custom ClassLoader needs to make unpredictable load-time modifications to classes, that ClassLoader must not attempt to use class data sharing.

See the Diagnostics Guide for more detail on this topic.

### Operating system limitations

You cannot share classes between 32-bit and 64-bit JVMs. Temporary disk space must be available to hold cache information. The operating system enforces cache permissions.

For operating systems that can run both 32-bit and 64-bit applications, class data sharing is not permitted between 32-bit and 64-bit JVMs. The listAllCaches suboption lists 32-bit or 64-bit caches, depending on the address mode of the JVM being used.

The shared class cache requires disk space to store identification information about the caches that exist on the system. This information is stored in `/tmp/javasharedresources`. If the identification information directory is deleted, the JVM cannot identify the shared classes on the system and must re-create the cache. Use the ipcs command to view the memory segments used by a JVM or application.

Users running a JVM must be in the same group to use a shared class cache. The operating system enforces the permissions for accessing a shared class cache. If you do not specify a cache name, the user name is appended to the default name so that multiple users on the same system create their own caches by default.

### Using SharedClassPermission

If a SecurityManager is being used with class data sharing and the running application uses its own class loaders, you must grant these class loaders shared class permissions before they can share classes.

You add shared class permissions to the `java.policy` file using the ClassLoader class name (wildcards are permitted) and either "read", "write", or "read,write" to determine the access granted. For example:

    permission com.ibm.oti.shared.SharedClassPermission
            "com.abc.customclassloaders.*", "read,write";

If a ClassLoader does not have the correct permissions, it is prevented from sharing classes. You cannot change the permissions of the default bootstrap, application, or extension class loaders.

## Adapting custom classloaders to share classes

Any classloader that extends java.net.URLClassLoader can share classes without modification. You must adopt classloaders that do not extend java.net.URLClassLoader to share class data.

You must grant all custom classloaders shared class permissions if a SecurityManager is being used; see Using SharedClassPermission. IBM provides several Java interfaces for various types of custom classloaders, which allow the classloaders to find and store classes in the shared class cache. These classes are in the com.ibm.oti.shared package.

The Javadoc document for this package is provided with the SDK in the `docs/apidoc.zip` file.

See the Diagnostics Guide for more information about how to use these interfaces.

# Java Communications API (JavaComm)

The Java Communications (API) package (JavaComm) is an optional package provided for use with the Runtime Environment for Linux on the IA32, PPC32/PPC64, and AMD64/EM64T platforms. You install JavaComm independently of the SDK or Runtime Environment.

The JavaComm API gives Java applications a platform-independent way of performing serial and parallel port communications for technologies such as voice mail, fax, and smartcards.

The Java Communications API supports Electronic Industries Association (EIA)-232 (RS232) serial ports and Institute of Electrical and Electronics Engineers (IEEE) 1284 parallel ports and is supported on systems with the IBM Version 5.0 Runtime Environment.

Using the Java Communications API, you can:

- List ports on a system
- Open and claim ownership of ports
- Resolve port ownership contention among applications that use Java Communications API
- Perform asynchronous and synchronous I/O port-monitoring using event notification
- Receive bean-style events describing state changes on the port

## Installing Java Communications API from a compressed file

Make sure that the SDK or Runtime Environment is installed before you install the Java Communications API.

### About this task

If you used the RPM package to install Java originally, install the Java Communications API from the RPM file. To install the Java Communications API from an RPM package, see Installing the Java Communications API from an RPM file.

To install the Java Communications API from a compressed file:

### Procedure

1. Download the Java Communications API compressed file from http://www.ibm.com/developerworks/java/jdk/linux/download.html.
2. Put the Java Communications API compressed file, `ibm-java2-javacomm-50-<plat>-<arch>.tar.gz`, in the directory where the SDK or Runtime Environment is installed. If you installed to the default directory, this is `/opt/ibm/java2-<arch>-50/`.
3. From a shell prompt, in the directory containing the compressed file, extract the contents:

       tar -xvzf ibm-java2-javacomm-50-<plat>-<arch>.tar.gz

   Where `<arch>` represents your architecture: i386, x86_64, ppc, ppc64, s390, or s390x.

## Installing the Java Communications API from an RPM file

Make sure that a copy of the SDK or Runtime Environment is installed before you install the Java Communications API.

### About this task

If you used the RPM package to install Java originally, install the Java Communications API from the RPM file.

### Procedure

1. Download the Java Communications API RPM package from http://www.ibm.com/developerworks/java/jdk/linux/download.html.
2. Open a shell prompt, making sure you are root.
3. Use the `rpm -ivh` command to install the Java Communications API RPM file. For example:

       rpm -ivh ibm-java2-<arch>-javacomm-5.0-0.0.<arch>.rpm

   The Java Communications API is installed in the /opt/ibm/java2-<arch>-50/ directory structure.

## Location of the Java Communications API files

By default, the Java Communications API files are installed in the `/opt/ibm/java2-<arch>-50/` directory.

The files and their structure are:

- `jre/lib/ext/comm.jar`
- `jre/bin/libibmcomm.so`
- `jre/lib/javax.comm.properties`

## Configuring the Java Communications API

To use the Java Communications API, you must change the access mode of serial and parallel ports, and set the PATH if you did not set it when you installed Java.

### About this task

See Setting the path.

### Changing the access mode of serial and parallel ports

After you install Java Communications API, you must change the access mode of serial and parallel ports so that users can access these devices.

#### About this task

You must give a user read and write access to the required devices. Log on as root and use the following commands, as applicable:

        chmod 660 /dev/ttyS0    (serial port COM1)
        chmod 660 /dev/ttyS1    (serial port COM2)
        chmod 660 /dev/ttyS2    (serial port COM3)
        chmod 660 /dev/ttyS3    (serial port COM4)
        chmod 660 /dev/parport0 (raw parallel ports)
        chmod 660 /dev/lp0      (parallel port LPT1)
        chmod 660 /dev/lp1      (parallel port LPT2)

Add specific users to the same group that the devices are in. On a SUSE system, for example, the devices are in the `uucp` group. Thus, users can be added to the `uucp` group to gain access to the devices.

Change the access mode of any other ports as needed.

### Specifying devices in the `javax.comm.properties` file

Use the javax.comm.properties file to specify the devices and drivers that are available to the Java Communications API and whether they are parallel or serial. Do not change this file without a very clear understanding of its use.

#### About this task

Port numbers are allocated sequentially to all devices. For example, if you specify `/dev/ttyS=PORT_SERIAL` and the devices `/dev/ttyS0` and `/dev/ttyS1` exist, they will be allocated COM1 and COM2.

To use the USB-serial connectors, uncomment the line `/dev/ttyUSB=PORT_SERIAL` in the `javax.comm.properties` file. If the devices `/dev/ttyUSB0` and `/dev/ttyUSB1` exist and COM1 and COM2 have already been defined, the USB-serial devices are allocated the next sequential ports, COM3 and COM4.

## Enabling serial ports on IBM ThinkPads

Most ThinkPads have their serial ports disabled by default in the BIOS. Currently, there is no way to enable the ports with Linux (the tpctl package does not enable the ports if they are disabled in the BIOS).

### About this task

To enable the ports in the BIOS, you must use the DOS version of the ThinkPad Configuration Utility that is available from the IBM ThinkPad Download site. To use the ThinkPad Configuration Utility, you need a bootable DOS diskette. The ThinkPad Configuration Utility might have been installed as part of the ThinkPad Utilities under Windows, depending on your installation options, and you can run it from a command prompt in Windows.

The ThinkPad Configuration application provided with Windows has options to enable or disable the serial and parallel ports but this does not also change the settings in the BIOS. So if you use this application with Windows, the ports are available; however, if you reboot your system with Linux, the ports will not be enabled.

## Printing limitation with the Java Communications API

When printing with the Java Communications API, you might have to select "Form feed", "Continue", or a similar option on the printer.

## Uninstalling Java Communications API

The process you use to uninstall the Java Communications API depends on whether you installed the installable Red Hat Package Manager (RPM) package or the compressed Tape Archive (TAR) package.

### About this task

### Uninstalling the Red Hat Package Manager (RPM) package

Uninstalling the Java Communications API using the RPM package.

#### About this task

#### Procedure

1. Use the rpm tool to uninstall the package. Enter the following command at a shell prompt:

       rpm -e ibm-java2-<arch>-javacomm-5.0-0.0

   Where <arch> is the architecture of your platform.

   Alternatively, you can use a graphical tool such as kpackage or yast2.
2. If the directory where you installed the Java Communications API does not contain any other tools that you require, remove that directory from your PATH statement.

### Uninstalling the compressed Tape Archive (TAR) package

Uninstalling the Java Communications API, if you installed the compressed TAR package.

#### About this task

Delete the following files from the directory where you installed them:

- `jre/lib/ext/comm.jar`
- `jre/bin/libibmcomm.so`
- `jre/lib/javax.comm.properties`

## The Java Communications API documentation

You can find API documentation and samples for the Java Communications API at the Sun Web site.

http://java.sun.com/products/javacomm/.

# Service and support for independent software vendors

Contact points for service:

If you are entitled to services for the Program code pursuant to the IBM Solutions Developer Program, contact the IBM Solutions Developer Program through your usual method of access or on the Web at: http://www.ibm.com/partnerworld/.

If you have purchased a service contract (that is, the IBM Personal Systems Support Line or equivalent service by country), the terms and conditions of that service contract determine what services, if any, you are entitled to receive with respect to the Program.

# Accessibility

The user guides that are supplied with this SDK and the Runtime Environment have been tested using screen readers.

To change the font sizes in the user guides, use the function that is supplied with your browser, typically found under the View menu option.

For users who require keyboard navigation, a description of useful keystrokes for Swing applications is in Swing Key Bindings at http://www.ibm.com/developerworks/java/jdk/additional/.

## Keyboard traversal of JComboBox components in Swing

If you traverse the drop-down list of a JComboBox component with the cursor keys, the button or editable field of the JComboBox does not change value until an item is selected. This is the correct behavior for this release and improves accessibility and usability by ensuring that the keyboard traversal behavior is consistent with mouse traversal behavior.

## Web Start accessibility (Linux IA 32-bit, PPC32, and PPC64 only)

From Version 5.0, Java Web Start contains several accessibility and usability improvements, including better support for screen readers and improved keyboard navigation.

You can use the command line to start a Java application that is enabled for Web Start. To change preference options, you must edit a configuration file, `.java/.deployment/.deployment.properties` in the user's home directory. Take a backup before you edit this file. Not all of the preferences that can be set in the Java Application Cache Viewer are available in the configuration file.

# Any comments on this user guide?

If you have any comments about this user guide, contact us through one of the following channels. Note that these channels are not set up to answer technical queries, but are for comments about the documentation only.

Send your comments:

- By e-mail to idrcf@hursley.ibm.com.
- By fax:
  - From the UK: 01962 842327
  - From elsewhere: +44 1962 842327
- By mail to:
  IBM United Kingdom Ltd
  User Technologies,
  Mail Point 095
  Hursley Park
  Winchester
  Hampshire
  SO21 2JN
  United Kingdom

The fine print. By choosing to send a message to IBM, you acknowledge that all information contained in your message, including feedback data, such as questions, comments, suggestions, or the like, shall be deemed to be non-confidential and IBM shall have no obligation of any kind with respect to such information and shall be free to reproduce, use, disclose, and distribute the information to others without limitation. Further, IBM shall be free to use any ideas, concepts, know-how or techniques contained in such information for any purpose whatsoever, including, but not limited to, developing, manufacturing and marketing products incorporating such information.

# Appendix A. Command-line options

You can specify the options on the command line while you are starting Java. They override any relevant environment variables. For example, using -cp <dir1> with the Java command completely overrides setting the environment variable CLASSPATH=<dir2>.

This chapter provides the following information:

- Specifying command-line options
- General command-line options
- System property command-line options
- JVM command-line options
- -XX command-line options
- JIT command-line options
- Garbage Collector command-line options

## Specifying command-line options

Although the command line is the traditional way to specify command-line options, you can pass options to the JVM in other ways.

Use only single or double quotation marks for command-line options when explicitly directed to do so for the option in question. Single and double quotation marks have different meanings on different platforms, operating systems, and shells. Do not use '-X<option>' or "-X<option>". Instead, you must use -X<option>. For example, do not use `'-Xmx500m'` and `"-Xmx500m"`. Write this option as `-Xmx500m`.

These precedence rules (in descending order) apply to specifying options:

1. Command line.

   For example, `java -X<option> MyClass`

2. A file containing a list of options, specified using the -Xoptionsfile option on the command line. For example, `java -Xoptionsfile=myoptionfile.txt MyClass`

   In the options file, specify each option on a new line; you can use the '\' character as a continuation character if you want a single option to span multiple lines. Use the '#' character to define comment lines. You cannot specify -classpath in an options file. Here is an example of an options file:

       #My options file
       -X<option1>
       -X<option2>=\
       <value1>,\
       <value2>
       -D<sysprop1>=<value1>

3. IBM_JAVA_OPTIONS environment variable. You can set command-line options using this environment variable. The options that you specify with this environment variable are added to the command line when a JVM starts in that environment.

   For example, `set IBM_JAVA_OPTIONS=-X<option1> -X<option2>=<value1>`

## General command-line options

Use these options to print help on assert-related options, set the search path for application classes and resources, print a usage method, identify memory leaks inside the JVM, print the product version and continue, enable verbose output, and print the product version.

-assert
  Prints help on assert-related options.
-cp, -classpath <directories and compressed or jar files separated by `:` (`;` on Windows)>
  Sets the search path for application classes and resources. If -classpath and -cp are not used, and the CLASSPATH environment variable is not set, the user classpath is, by default, the current directory (`.`).
-help, -?
  Prints a usage message.
-memorycheck[:<option>]
  Identifies memory leaks inside the JVM using strict checks that cause the JVM to exit on failure. If no option is specified, all is used by default. Options are:
  - all
    - The default if -memorycheck only is used. This option enables checking of all allocated and freed blocks on every free and allocate call. This check of the heap is the most thorough. It causes the JVM to exit on nearly all memory-related problems soon after they are caused. This option has the greatest affect on performance.
  - callsite=<number of allocations>
    - Prints callsite information every <number of allocations>. Deallocations are not counted. Callsite information is presented in a table with separate information for each callsite. Statistics include the number and size of allocation and free requests since the last report, and the number of the allocation request responsible for the largest allocation from each site. Callsites are presented as `sourcefile:linenumber` for C code and assembly function name for assembler code.

      Callsites that do not provide callsite information are accumulated into an "unknown" entry.

  - failat=<number of allocations>
    - Causes memory allocation to fail (return NULL) after <number of allocations>. Setting <number of allocations> to 13 causes the 14th allocation to return NULL. Deallocations are not counted. Use this option to ensure that JVM code reliably handles allocation failures. This option is useful for checking allocation site behavior rather than setting a specific allocation limit.
  - nofree
    - Keeps a list of already used blocks instead of freeing memory. This list is checked, along with currently allocated blocks, for memory corruption on every allocation and deallocation. Use this option to detect a dangling pointer (a pointer that is "dereferenced" after its target memory is freed). This option cannot be reliably used with long-running applications (such as WebSphere Application Server), because "freed" memory is never reused or released by the JVM.
  - quick
    - Enables block padding only. Used to detect basic heap corruption. Pads every allocated block with sentinel bytes, which are verified on every allocate and free. Block padding is faster than the default of checking every block, but is not as effective.
  - skipto=<number of allocations>
    - Causes the program to check only on allocations that occur after <number of allocations>. Deallocations are not counted. Used to speed up JVM startup when early allocations are not causing the memory problem. As a rough estimate, the JVM performs 250+ allocations during startup.
  - zero
    - Newly allocated blocks are set 0 instead of being filled with the `0xE7E7xxxxxxxxE7E7` pattern. Setting to 0 helps you to determine whether a callsite is expecting zeroed memory (in which case after the allocation request by using the instruction `memset(pointer, 0, size)`).
-showversion
  Prints product version and continues.
-verbose:<option>[,<option>...]
  Enables verbose output. Separate multiple options using commas. These options are available:
  class
    Writes an entry to `stderr` for each class that is loaded.
  dynload
    Provides detailed information as each bootstrap class is loaded by the JVM:
    - The class name and package
    - For class files that were in a .jar file, the name and directory path of the .jar
    - Details of the size of the class and the time taken to load the class
    The data is written out to `stderr`. An example of the output on a Windows platform follows:

        <Loaded java/lang/String from C:\sdk\jre\lib\vm.jar>
        <Class size 17258; ROM size 21080; debug size 0>
        <Read time 27368 usec; Load time 782 usec; Translate time 927 usec>

  gc
    Provide verbose garbage collection information.
  init
    Writes information to `stderr` describing JVM initialization and termination.
  jni
    Writes information to `stderr` describing the JNI services called by the application and JVM.
  sizes
    Writes information to `stderr` describing the active memory usage settings.
  stack
    Writes information to `stderr` describing the Java and C stack usage for each thread.
-version
  Prints product version.

## System property command-line options

Use the system property command-line options to set up your system.

-D<name>=<value>
  Sets a system property.
-DCLONE_HASHTABLE_FOR_SYNCHRONIZATION
  Deadlocks can occur when serializing multiple java.util.Hashtables that refer to each other in different threads at the same time. Using this command-line option can resolve the deadlock, by forcing the JVM to take a copy of every java.util.Hashtable before this hashtable is serialized. Because this process requires temporary storage, and uses additional processing power, the option is not enabled by default.
-Dcom.ibm.jsse2.renegotiate=[ALL | NONE | ABBREVIATED]
  If your Java application uses JSSE for secure communication, you can disable TLS renegotiation by installing APAR IZ65239.
  ALL
    Allow both abbreviated and unabbreviated (full) renegotiation handshakes.
  NONE
    Allow no renegotiation handshakes. This value is the default setting.
  ABBREVIATED
    Allow only abbreviated renegotiation handshakes.
-Dcom.ibm.lang.management.verbose
  Enables verbose information from java.lang.management operations to be written to output channel during VM operation.
-Dcom.ibm.IgnoreMalformedInput=true
  From Java 5 SR12, any invalid UTF8 or malformed byte sequences are replaced with the standard unicode replacement character `\uFFFD`. To retain the old behavior, where invalid UTF8 or malformed byte sequences are ignored, set this system property to true.
-Dcom.ibm.nio.DirectByteBuffer.AggressiveMemoryManagement=true
  Use this property to increase dynamically the native memory limit for Direct Byte Buffers, based on their usage. This option is applicable when a Java application uses many Direct Byte Buffer objects, but cannot predict the maximum native memory consumption of the objects. Do not use the -Xsun.nio.MaxDirectMemorySize option with this property.
-Dcom.ibm.nio.useIBMAlias=true
  The IBM JVM cannot display all the Big5-HKSCS characters when using the NIO converter. By specifying the -Dcom.ibm.nio.useIBMAlias=true option, you can use the ICU4J API to display Big5-HKSCS characters without modifying the application.
-Dcom.ibm.tools.attach.enable=yes
  Enable the Attach API for this application. The Attach API allows your application to connect to a virtual machine. Your application can then load an agent application into the virtual machine. The agent can be used to perform tasks such as monitoring the virtual machine status.
-Dcom.ibm.zipfile.closeinputstreams=true
  The Java.util.zip.ZipFile class allows you to create InputStreams on files held in a compressed archive. Under some conditions, using ZipFile.close() to close all InputStreams that have been opened on the compressed archive might result in a 56-byte-per-InputStream native memory leak. Setting the -Dcom.ibm.zipfile.closeinputstreams=true forces the JVM to track and close InputStreams without the memory impact caused by retaining native-backed objects.
-Dibm.jvm.bootclasspath
  The value of this property is used as an additional search path, which is inserted between any value that is defined by -Xbootclasspath/p: and the bootclass path. The bootclass path is either the default or the one that you defined by using the -Xbootclasspath: option.
-Dibm.stream.nio=[true | false]
  From v1.4.1 onwards, by default the IO converters are used. This option addresses the ordering of IO and NIO converters. When this option is set to true, the NIO converters are used instead of the IO converters.
-Djava.compiler=[NONE | j9jit23]
  Disables the Java compiler by setting to NONE. Enable JIT compilation by setting to j9jit23 (Equivalent to -Xjit).
-Djava.net.connectiontimeout=[n]
  'n' is the number of seconds to wait for the connection to be established with the server. If this option is not specified in the command line, the default value of 0 (infinity) is used. The value can be used as a timeout limit when an asynchronous java-net application is trying to establish a connection with its server. If this value is not set, a java-net application waits until the default connection timeout value is met. For instance, `java -Djava.net.connectiontimeout=2 TestConnect` causes the java-net client application to wait only 2 seconds to establish a connection with its server.
-Dsun.awt.keepWorkingSetOnMinimize=true
  When a Java application using the Abstract Windowing Toolkit (AWT) is minimized, the default behavior is to "trim" the "working set". The working set is the application memory stored in RAM. Trimming means that the working set is marked as being available for swapping out if the memory is required by another application. The advantage of trimming is that memory is available for other applications. The disadvantage is that a "trimmed" application might experience a delay as the working set memory is brought back into RAM.

  The -Dsun.awt.keepWorkingSetOnMinimize=true system property stops the JVM trimming an application when it is minimized. The default behavior is to trim an application when it is minimized.

-Dsun.net.client.defaultConnectTimeout=<value in milliseconds>
  Specifies the default value for the connect timeout for the protocol handlers used by the java.net.URLConnection class. The default value set by the protocol handlers is -1, which means that no timeout is set.

  When a connection is made by an applet to a server and the server does not respond properly, the applet might seem to hang. The delay might also cause the browser to hang. The apparent hang occurs because there is no network connection timeout. To avoid this problem, the Java Plug-in has added a default value to the network timeout of 2 minutes for all HTTP connections. You can override the default by setting this property.

-Dsun.net.client.defaultReadTimeout=<value in milliseconds>
  Specifies the default value for the read timeout for the protocol handlers used by the java.net.URLConnection class when reading from an input stream when a connection is established to a resource. The default value set by the protocol handlers is -1, which means that no timeout is set.
-Dsun.nio.MaxDirectMemorySize=<value in bytes>
  Limits the native memory size for nio Direct Byte Buffer objects to the value specified.
-Dsun.rmi.transport.tcp.connectionPool=[true | any non-null value]
  Enables thread pooling for the RMI ConnectionHandlers in the TCP transport layer implementation.
-Dsun.timezone.ids.oldmapping=[true | false]
  From v5.0 Service Refresh 1 onwards, the Java Virtual Machine uses new time zone identifiers. The identifiers change the definitions of Eastern Standard Time (EST) and Mountain Standard Time (MST). These new definitions do not take daylight saving time (DST) into account. If this property is set to true, the definitions for EST and MST revert to the definitions that were used before v5.0 Service Refresh 1, and DST is taken into account. By default, this property is set to true.
-Dswing.useSystemFontSettings=[false]
  From v1.4.1 onwards, by default, Swing programs running with the Windows Look and Feel render with the system font set by the user instead of a Java-defined font. As a result, fonts for v1.4.1 differ from the fonts in earlier releases. This option addresses compatibility problems like these for programs that depend on the old behavior. By setting this option, v1.4.1 fonts and those of earlier releases are the same for Swing programs running with the Windows Look and Feel.

## JVM command-line options

Use these options to configure your JVM. The options prefixed with -X are nonstandard.

For options that take a <size> parameter, suffix the number with "k" or "K" to indicate kilobytes, "m" or "M" to indicate megabytes, or "g" or "G" to indicate gigabytes.

For options that take a <percentage> parameter, use a number from 0 to 1. For example, 50% is 0.5.

Options that relate to the JIT are listed under JIT command-line options. Options that relate to the Garbage Collector are listed under Garbage Collector command-line options.

-X
  Displays help on nonstandard options.

-Xargencoding
  You can put Unicode escape sequences in the argument list. This option is set to off by default.
-Xbootclasspath:<directories and compressed or Java archive files separated by : (; on Windows)>
  Sets the search path for bootstrap classes and resources. The default is to search for bootstrap classes and resources in the internal VM directories and .jar files.
-Xbootclasspath/a:<directories and compressed or Java archive files separated by : (; on Windows)>
  Appends the specified directories, compressed files, or jar files to the end of the bootstrap class path. The default is to search for bootstrap classes and resources in the internal VM directories and .jar files.
-Xbootclasspath/p:<directories and compressed or Java archive files separated by : (; on Windows)>
  Adds a prefix of the specified directories, compressed files, or Java archive files to the front of the bootstrap class path. Do not deploy applications that use the -Xbootclasspath: or the -Xbootclasspath/p: option to override a class in the standard API. This is because such a deployment contravenes the Java 2 Runtime Environment binary code license. The default is to search for bootstrap classes and resources in the internal VM directories and .jar files.
-Xcheck:jni[:help][:<option>=<value>]
  Performs additional checks for JNI functions. This option is equivalent to -Xrunjnichk. By default, no checking is performed.
-Xclassgc
  Enables dynamic unloading of classes by the JVM. This is the default behavior. To disable dynamic class unloading, use the -Xnoclassgc option.
-Xdbg:<options>
  Loads debugging libraries to support the remote debugging of applications. This option is equivalent to -Xrunjdwp. By default, the debugging libraries are not loaded, and the VM instance is not enabled for debug.
-Xdbginfo:<path to symbol file>
  Loads and passes options to the debug information server. By default, the debug information server is disabled.
-Xdebug
  This option is deprecated. Use -Xdbg for debugging.
-Xdiagnosticscollector[:settings=<filename>]
  Enables the Diagnostics Collector. See the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) section on "The Diagnostics Collector" for more information. The settings option allows you to specify a different Diagnostics Collector settings file to use instead of the default `dc.properties` file in the JRE.
-Xdisablejavadump
  Turns off Javadump generation on errors and signals. By default, Javadump generation is enabled.
-Xdump
  See the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) section on "Using dump agents" for more information.
-Xenableexplicitgc
  Signals to the VM that calls to System.gc() trigger a garbage collection. This option is enabled by default.
-Xfuture
  Turns on strict class-file format checks. Use this flag when you are developing new code because stricter checks will become the default in future releases. By default, strict format checks are disabled.
-Xiss<size>
  Sets the initial stack size for Java threads. By default, the stack size is set to 2 KB. Use the -verbose:sizes option to output the value that the VM is using.
-Xjarversion
  Produces output information about the version of each jar file in the class path, the boot class path, and the extensions directory. Version information is taken from the Implementation-Version and Build-Level properties in the manifest of the jar.
-Xjni:<suboptions>
  Sets JNI options. You can use the following suboption with the -Xjni option:
  -Xjni:arrayCacheMax=[<size in bytes>|unlimited]
    Sets the maximum size of the array cache. The default size is 8096 bytes.
-Xlinenumbers
  Displays line numbers in stack traces for debugging. See also -Xnolinenumbers. By default, line numbers are on.

-Xlog

  Enables message logging. To prevent message logging, use the -Xlog:none option. By default, logging is enabled. This option is available from Java 5 SR10. See Messages.

-Xlp<size> (AIX®, Windows, and Linux (x86, PPC32, PPC64, AMD64, EM64T))
  Linux: Requests the JVM to allocate the Java heap with large pages. If large pages are not available, the JVM does not start, displaying the error message `GC: system configuration does not support option --> '-Xlp'`. The JVM uses shmget() to allocate large pages for the heap. Large pages are supported by systems running Linux kernels v2.6 or higher. By default, large pages are not used.
-Xmso<size>
  Sets the initial stack size for operating system threads. The default value can be determined by running the command:

      java -verbose:sizes

  The maximum value for the stack size varies according to platform and specific machine configuration. If you exceed the maximum value, a `java/lang/OutOfMemoryError` message is reported.
-Xmxcl<number>
  Sets the maximum number of class loaders. See the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) section on "The parent-delegation model" for a description of a problem that can occur on some JVMs if this number is set too low.
-Xnoagent
  Disables support for the old JDB debugger.
-Xnoclassgc
  Disables dynamic class unloading. This option disables the release of native and Java heap storage associated with Java class loaders and classes that are no longer being used by the JVM. The default behavior is as defined by -Xclassgc. Enabling this option is not recommended except under the direction of the IBM Java support team. The reason is the option can cause unlimited native memory growth, leading to out-of-memory errors.
-Xnolinenumbers
  Disables the line numbers for debugging. See also -Xlinenumbers. By default, line number are on.
-Xnosigcatch
  Disables JVM signal handling code. See also -Xsigcatch. By default, signal handling is enabled.
-Xnosigchain
  Disables signal handler chaining. See also -Xsigchain. By default, the signal handler chaining is enabled.
-Xoptionsfile=<file>

  Specifies a file that contains JVM options and definitions. By default, no option file is used.

  The options file does not support these options:

  - -version
  - -showversion
  - -fullversion
  - -Xjarversion
  - -memorycheck
  - -assert
  - -help
  - -Xoptionsfile

  Although you cannot use -Xoptionsfile recursively within an options file, you can use -Xoptionsfile multiple times on the same command line to load more than one options files.

  <file> contains options that are processed as if they had been entered directly as command-line options. For example, the options file might contain:

      -DuserString=ABC123
      -Xmx256MB

  Some options use quoted strings as parameters. Do not split quoted strings over multiple lines using the line continuation character '\'. The '¥' character is not supported as a line continuation character. For example, the following example is not valid in an options file:

      -Xevents=vmstop,exec="cmd /c \
      echo %pid has finished."

  The following example is valid in an options file:

      -Xevents=vmstop, \
      exec="cmd /c echo %pid has finished."

-Xoss<size>
  Recognized but deprecated. Use -Xss and -Xmso. Sets the maximum Java stack size for any thread. The maximum value for the stack size varies according to platform and specific machine configuration. If you exceed the maximum value, a `java/lang/OutOfMemoryError` message is reported.
-Xrdbginfo:<host>:<port>
  Loads the remote debug information server with the specified host and port. By default, the remote debug information server is disabled.
-Xrs
  Reduces the use of operating system signals, preventing the JVM from installing signal handlers for all but exception type signals (such as SIGSEGV, SIGILL, SIGFPE). By default, the VM makes full use of operating system signals.
  Note: Linux always uses SIGU3R1 and SIGU3R2.
-Xrun<library name>[:<options>]
  Loads helper libraries. To load multiple libraries, specify it more than once on the command line. Examples of these libraries are:
  -Xrunhprof[:help] | [:<option>=<value>, ...]
    Performs heap, CPU, or monitor profiling.
  -Xrunjdwp[:help] | [:<option>=<value>, ...]
    Loads debugging libraries to support the remote debugging of applications. This option is the same as -Xdbg.
  -Xrunjnichk[:help] | [:<option>=<value>, ...]
    Deprecated. Use -Xcheck:jni instead.
-Xscmx<size>
  Specifies cache size. This option applies only if a cache is being created and no cache of the same name exists. The default cache size is platform-dependent. You can find out the size value being used by adding -verbose:sizes as a command-line argument. Minimum cache size is 4 KB. Maximum cache size is platform-dependent. The size of cache that you can specify is limited by the amount of physical memory and paging space available to the system. The virtual address space of a process is shared between the shared classes cache and the Java heap. Increasing the maximum size of the Java heap reduces the size of the shared classes cache that you can create.
-Xshareclasses:<suboptions>

  Enables class sharing. This option can take a number of suboptions, some of which are cache utilities. Cache utilities perform the required operation on the specified cache, without starting the VM. You can combine multiple suboptions, separated by commas, but the cache utilities are mutually exclusive.

  You can use the following suboptions with the -Xshareclasses option:

  destroy (Utility option)
    Destroys a cache using the name specified in the name=<name> suboption. If the name is not specified, the default cache is destroyed. A cache can be destroyed only if all virtual machines using it have shut down, and the user has sufficient permissions.
  destroyAll (Utility option)
    Tries to destroy all caches available to the user. A cache can be destroyed only if all virtual machines using it have shut down, and the user has sufficient permissions.
  expire=<time in minutes> (Utility option)
    Destroys all caches that have been unused for the time specified before loading shared classes. This option is not a utility option because it does not cause the JVM to exit.
  groupAccess
    Sets operating system permissions on a new cache to allow group access to the cache. The default is user access only.
  help
    Lists all the command-line options.
  listAllCaches (Utility option)
    Lists all the caches on the system, describing if they are in use and when they were last used.
  modified=<modified context>
    Used when a JVMTI agent is installed that might modify bytecode at run time. If you do not specify this suboption and a bytecode modification agent is installed, classes are safely shared with an extra performance cost. The <modified context> is a descriptor chosen by the user; for example, myModification1. This option partitions the cache, so that only JVMs using context myModification1 can share the same classes. For instance, if you run an application with a modification context and then run it again with a different modification context, all classes are stored twice in the cache. See the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) section "Dealing with runtime bytecode modification" for more information.
  name=<name>
    Connects to a cache of a given name, creating the cache if it does not exist. This option is also used to indicate the cache that is to be modified by cache utilities; for example, destroy. Use the listAllCaches utility to show which named caches are currently available. If you do not specify a name, the default name "sharedcc_%u" is used. "%u" in the cache name inserts the current user name. You can specify "%g" in the cache name to insert the current group name.
  none
    Added to the end of a command line, disables class data sharing. This suboption overrides class sharing arguments found earlier on the command line.
  nonfatal
    Allows the JVM to start even if class data sharing fails. Normal behavior for the JVM is to refuse to start if class data sharing fails. If you select nonfatal and the shared classes cache fails to initialize, the JVM starts without class data sharing.
  printAllStats (Utility option)
    Displays detailed information about the contents of the cache specified in the name=<name> suboption. If the name is not specified, statistics are displayed about the default cache. Every class is listed in chronological order with a reference to the location from which it was loaded. See the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) section on the "printAllStats utility" for more information.
  printStats (Utility option)
    Displays summary statistics information about the cache specified in the name=<name> suboption. If the name is not specified, statistics are displayed about the default cache. The most useful information displayed is how full the cache is and how many classes it contains. Stale classes are classes that have been updated on the file system and which the cache has therefore marked "stale". Stale classes are not purged from the cache. See the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) section on the "printStats utility" for more information.
  safemode
    Forces the JVM to load all classes from disk and apply the modifications to those classes (if applicable). See the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) section on "Using the safemode option" for more information.
  silent
    Disables all shared class messages, including error messages. Unrecoverable error messages, which prevent the JVM from initializing, are displayed.
  verbose
    Gives detailed output on the cache I/O activity, listing information about classes being stored and found. Each class loader is given a unique ID (the bootstrap loader is always 0) and the output shows the class loader hierarchy at work, where class loaders must ask their parents for a class before they can load it themselves. It is typical to see many failed requests; this behavior is expected for the class loader hierarchy. The standard option -verbose:class also enables class sharing verbose output if class sharing is enabled.
  verboseHelper
    Enables verbose output for the Java Helper API. This output shows you how the Helper API is used by your ClassLoader.
  verboseIO
    Gives detailed output on the cache I/O activity, listing information about classes being stored and found. Each class loader is given a unique ID (the bootstrap loader is always 0) and the output shows the class loader hierarchy at work, where class loaders must ask their parents for a class before they can load it themselves. It is typical to see many failed requests; this behavior is expected for the class loader hierarchy.
-Xsigcatch
  Enables VM signal handling code. See also -Xnosigcatch. By default, signal handling is enabled.
-Xsigchain
  Enables signal handler chaining. See also -Xnosigchain. By default, signal handler chaining is enabled.
-Xss<size>
  Sets the maximum stack size for Java threads. The default is 256 KB for 32-bit JVMs and 512 KB for 64-bit JVMs. The maximum value varies according to platform and specific machine configuration. If you exceed the maximum value, a `java/lang/OutOfMemoryError` message is reported.
-Xssi<size>
  Sets the stack size increment for Java threads. When the stack for a Java thread becomes full it is increased in size by this value until the maximum size (-Xss) is reached. The default is 16 KB.
-Xthr:minimizeUserCPU
  Minimizes user-mode CPU usage in thread synchronization where possible. The reduction in CPU usage might be a trade-off in exchange for lower performance.

-Xtrace[:help] | [:<option>=<value>, ...]
  See the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) section on the "Controlling the trace" for more information.
-Xverify[:<option>]
  With no parameters, enables the verifier, which is the default. Therefore, if used on its own with no parameters, for example, -Xverify, this option does nothing. Optional parameters are as follows:
  - all - enable maximum verification
  - none - disable the verifier
  - remote - enables strict class-loading checks on remotely loaded classes
  The verifier is on by default and must be enabled for all production servers. Running with the verifier off is not a supported configuration. If you encounter problems and the verifier was turned off using -Xverify:none, remove this option and try to reproduce the problem.

### -XX command-line options

JVM command-line options that are specified with -XX are not stable and are not recommended for casual use.

These options are subject to change without notice.

-XXallowvmshutdown:[false|true]
  This option is provided as a workaround for customer applications that cannot shut down cleanly, as described in APAR IZ59734. Customers who need this workaround should use -XXallowvmshutdown:false. The default option is -XXallowvmshutdown:true for Java 5 SR10 onwards.
-XX:-StackTraceInThrowable
  This option removes stack traces from exceptions. By default, stack traces are available in exceptions. Including a stack trace in exceptions requires walking the stack and that can affect performance. Removing stack traces from exceptions can improve performance but can also make problems harder to debug.

  When this option is enabled, Throwable.getStackTrace() returns an empty array and the stack trace is displayed when an uncaught exception occurs. Thread.getStackTrace() and Thread.getAllStackTraces() are not affected by this option.

## JIT command-line options

Use these JIT compiler command-line options to control code compilation.

For more information about JIT , see the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html).

-Xcodecache<size>
  This option is used to tune performance. It sets the size of each block of memory that is allocated to store the native code of compiled Java methods. By default, this size is selected internally according to the processor architecture and the capability of your system. If profiling tools show significant costs in trampolines, that is a good reason to change the size until the costs are reduced. Changing the size does not mean always increasing the size. The option provides the mechanism to tune for the right size until hot interblock calls are eliminated. A reasonable starting point to tune for the optimal size is (totalNumberByteOfCompiledMethods * 1.1).
  Note: Trampolines are where reflection is used to avoid inner classes. JVMTI identifies trampolines in a methodLoad2 event.
-Xint
  Makes the JVM use the Interpreter only, disabling the Just-In-Time (JIT) compilers. By default, the JIT compiler is enabled.
-Xjit[:<parameter>=<value>, ...]
  With no parameters, enables the JIT compiler. The JIT compiler is enabled by default, so using this option on its own has no effect. Use this option to control the behavior of the JIT compiler. Useful parameters are:
  count=<n>
    Where <n> is the number of times a method is called before it is compiled or loaded from an existing shared class cache. For example, setting `count=0` forces the JIT compiler to compile everything on first execution.
  limitFile=(<filename>, <m>, <n>)
    Compile only the methods listed on lines <m> to <n> in the specified limit file. Methods not listed in the limit file and methods listed on lines outside the range are not compiled.
  optlevel=[ noOpt | cold | warm | hot | veryHot | scorching ]
    Forces the JIT compiler to compile all methods at a specific optimization level. Specifying optlevel might have an unexpected effect on performance, including lower overall performance.
  verbose
    Reports information about the JIT and AOT compiler configuration and method compilation.
-Xquickstart
  Causes the JIT compiler to run with a subset of optimizations. The effect is faster compilation times that improve startup time, but longer running applications might run slower. -Xquickstart can degrade performance if it is used with long-running applications that contain hot methods. The implementation of -Xquickstart is subject to change in future releases. By default, -Xquickstart is disabled.

-XsamplingExpirationTime<time> (from Service Refresh 5)
  Disables the JIT sampling thread after <time> seconds. When the JIT sampling thread is disabled, no processor cycles are used by an idle JVM.

## Garbage Collector command-line options

Use these Garbage Collector command-line options to control garbage collection.

You might need to read the section on "Memory management" in the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) to understand some of the references that are given here.

The -verbose:gc option detailed in the section on "-verbose:gc logging" in the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) is the main diagnostic aid that is available for runtime analysis of the Garbage Collector. However, additional command-line options are available that affect the behavior of the Garbage Collector and might aid diagnostics.

For options that take a <size> parameter, suffix the number with "k" or "K" to indicate kilobytes, "m" or "M" to indicate megabytes, or "g" or "G" to indicate gigabytes.

For options that take a <percentage> parameter, use a number from 0 to 1, for example, 50% is 0.5.

-Xalwaysclassgc
  Always perform dynamic class unloading checks during global collection. The default behavior is as defined by -Xclassgc.
-Xclassgc
  Enables the collection of class objects only on class loader changes. This behavior is the default.
-Xcompactexplicitgc
  Enables full compaction each time System.gc() is called.
-Xcompactgc
  Compacts on all garbage collections (system and global).

  The default (no compaction option specified) makes the GC compact based on a series of triggers that attempt to compact only when it is beneficial to the future performance of the JVM.

-Xconcurrentbackground<number>
  Specifies the number of low-priority background threads attached to assist the mutator threads in concurrent mark. The default is 1.
-Xconcurrentlevel<number>
  Specifies the allocation "tax" rate. It indicates the ratio between the amount of heap allocated and the amount of heap marked. The default is 8.
-Xconmeter:<soa | loa | dynamic>
  This option determines the usage of which area, LOA (Large Object Area) or SOA (Small Object Area), is metered and hence which allocations are taxed during concurrent mark. Using -Xconmeter:soa (the default) applies the allocation tax to allocations from the small object area (SOA). Using -Xconmeter:loa applies the allocation tax to allocations from the large object area (LOA). If -Xconmeter:dynamic is specified, the collector dynamically determines which area to meter based on which area is exhausted first, whether it is the SOA or the LOA.
-Xdisableexcessivegc
  Disables the throwing of an OutOfMemory exception if excessive time is spent in the GC.
-Xdisableexplicitgc

  Disables System.gc() calls.

  Many applications still make an excessive number of explicit calls to System.gc() to request garbage collection. In many cases, these calls degrade performance through premature garbage collection and compactions. However, you cannot always remove the calls from the application.

  The -Xdisableexplicitgc parameter allows the JVM to ignore these garbage collection suggestions. Typically, system administrators use this parameter in applications that show some benefit from its use.

  By default, calls to System.gc() trigger a garbage collection.

-Xdisablestringconstantgc
  Prevents strings in the string intern table from being collected.
-Xenableexcessivegc
  If excessive time is spent in the GC, the option returns null for an allocate request and thus causes an OutOfMemory exception to be thrown. This action occurs only when the heap has been fully expanded and the time spent is making up at least 95%. This behavior is the default.
-Xenablestringconstantgc
  Enables strings from the string intern table to be collected. This behavior is the default.
-Xgc:<options>
  Passes options such as verbose, compact, and nocompact to the Garbage Collector.
-Xgcpolicy:<optthruput | optavgpause | gencon | subpool (AIX, Linux and IBM i on IBM POWER® architecture, Linux and z/OS® on zSeries) >
  Controls the behavior of the Garbage Collector.

  The optthruput option is the default and delivers high throughput to applications, but at the cost of occasional pauses. Disables concurrent mark.

  The optavgpause option reduces the time that is spent in these garbage collection pauses and limits the effect of increasing heap size on the length of the garbage collection pause. Use optavgpause if your configuration has a large heap. Enables concurrent mark.

  The gencon option requests the combined use of concurrent and generational GC to help minimize the time that is spent in any garbage collection pause.

  The subpool option (AIX, Linux and IBM i on IBM POWER architecture, and z/OS) uses an improved object allocation algorithm to achieve better performance when allocating objects on the heap. This option might improve performance on large SMP systems.

-Xgcthreads<number>
  Sets the number of threads that the Garbage Collector uses for parallel operations. This total number of GC threads is composed of one application thread with the remainder being dedicated GC threads. By default, the number is set to the number of physical CPUs present. To set it to a different number (for example 4), use -Xgcthreads4. The minimum valid value is 1, which disables parallel operations, at the cost of performance. No advantage is gained if you increase the number of threads above the default setting; you are recommended not to do so.

  On systems running multiple JVMs or in LPAR environments where multiple JVMs can share the same physical CPUs, you might want to restrict the number of GC threads used by each JVM. The restriction helps prevent the total number of parallel operation GC threads for all JVMs exceeding the number of physical CPUs present, when multiple JVMs perform garbage collection at the same time.

-Xgcworkpackets<number>
  Specifies the total number of work packets available in the global collector. If not specified, the collector allocates a number of packets based on the maximum heap size.
-Xloa
  Allocates a large object area (LOA). Objects are allocated in this LOA rather than the SOA. By default, the LOA is enabled for all GC policies except for subpool, where the LOA is not available.
-Xloainitial<percentage>
  Specifies the initial percentage (between 0 and 0.95) of the current tenure space allocated to the large object area (LOA). The default value is 0.05, which is 5%.
-Xloamaximum<percentage>
  Specifies the maximum percentage (between 0 and 0.95) of the current tenure space allocated to the large object area (LOA). The default value is 0.5, which is 50%.
-Xmaxe<size>
  Sets the maximum amount by which the garbage collector expands the heap. Typically, the garbage collector expands the heap when the amount of free space falls below 30% (or by the amount specified using -Xminf), by the amount required to restore the free space to 30%. The -Xmaxe option limits the expansion to the specified value; for example `-Xmaxe10M` limits the expansion to 10 MB. By default, there is no maximum expansion size.
-Xmaxf<percentage>
  Specifies the maximum percentage of heap that must be free after a garbage collection. If the free space exceeds this amount, the JVM tries to shrink the heap. The default value is 0.6 (60%).
-Xmaxt<percentage>
  Specifies the maximum percentage of time to be spent in Garbage Collection. If the percentage of time rises above this value, the JVM tries to expand the heap. The default value is 13%.
-Xmca<size>
  Sets the expansion step for the memory allocated to store the RAM portion of loaded classes. Each time more memory is required to store classes in RAM, the allocated memory is increased by this amount. By default, the expansion step is 32 KB. Use the -verbose:sizes option to determine the value that the VM is using. If the expansion step size you choose is too large, `OutOfMemoryError` is reported. The exact value of a "too large" expansion step size varies according to the platform and the specific machine configuration.
-Xmco<size>
  Sets the expansion step for the memory allocated to store the ROM portion of loaded classes. Each time more memory is required to store classes in ROM, the allocated memory is increased by this amount. By default, the expansion step is 128 KB. Use the -verbose:sizes option to determine the value that the VM is using. If the expansion step size you choose is too large, `OutOfMemoryError` is reported. The exact value of a "too large" expansion step size varies according to the platform and the specific machine configuration.
-Xmine<size>
  Sets the minimum amount by which the Garbage Collector expands the heap. Typically, the garbage collector expands the heap by the amount required to restore the free space to 30% (or the amount specified using -Xminf). The -Xmine option sets the expansion to be at least the specified value; for example, `-Xmine50M` sets the expansion size to a minimum of 50 MB. By default, the minimum expansion size is 1 MB.
-Xminf<percentage>
  Specifies the minimum percentage of heap to be left free after a garbage collection. If the free space falls below this amount, the JVM attempts to expand the heap. The default value is 30%.
-Xmint<percentage>
  Specifies the minimum percentage of time to spend in Garbage Collection. If the percentage of time drops below this value, the JVM tries to shrink the heap. The default value is 5%.
-Xmn<size>
  Sets the initial and maximum size of the new area to the specified value when using -Xgcpolicy:gencon. Equivalent to setting both -Xmns and -Xmnx. If you set either -Xmns or -Xmnx, you cannot set -Xmn. If you try to set -Xmn with either -Xmns or -Xmnx, the VM does not start, returning an error. By default, -Xmn is not set. If the scavenger is disabled, this option is ignored.
-Xmns<size>
  Sets the initial size of the new area to the specified value when using -Xgcpolicy:gencon. By default, this option is set to 25% of the value of the -Xms option or 64 MB, whichever is less. This option returns an error if you try to use it with -Xmn. You can use the -verbose:sizes option to find out the values that the VM is currently using. If the scavenger is disabled, this option is ignored.
-Xmnx<size>
  Sets the maximum size of the new area to the specified value when using -Xgcpolicy:gencon. By default, this option is set to 25% of the value of the -Xmx option or 64 MB, whichever is less. This option returns an error if you try to use it with -Xmn. You can use the -verbose:sizes option to find out the values that the VM is currently using. If the scavenger is disabled, this option is ignored.
-Xmo<size>
  Sets the initial and maximum size of the old (tenured) heap to the specified value when using -Xgcpolicy:gencon. Equivalent to setting both -Xmos and -Xmox. If you set either -Xmos or -Xmox, you cannot set -Xmo. If you try to set -Xmo with either -Xmos or -Xmox, the VM does not start, returning an error. By default, -Xmo is not set.
-Xmoi<size>
  Sets the amount the Java heap is incremented when using -Xgcpolicy:gencon. If set to zero, no expansion is allowed. By default, the increment size is calculated on the expansion size, set by -Xmine and -Xminf.
-Xmos<size>
  Sets the initial size of the old (tenure) heap to the specified value when using -Xgcpolicy:gencon. By default, this option is set to the value of the -Xms option minus the value of the -Xmns option. This option returns an error if you try to use it with -Xmo. You can use the -verbose:sizes option to find out the values that the VM is currently using.
-Xmox<size>
  Sets the maximum size of the old (tenure) heap to the specified value when using -Xgcpolicy:gencon. By default, this option is set to the same value as the -Xmx option. This option returns an error if you try to use it with -Xmo. You can use the -verbose:sizes option to find out the values that the VM is currently using.
-Xmr<size>
  Sets the size of the Garbage Collection "remembered set". This set is a list of objects in the old (tenured) heap that have references to objects in the new area. By default, this option is set to 16 K.
-Xmrx<size>
  Sets the remembered maximum size setting.
-Xms<size>
  Sets the initial Java heap size. You can also use the -Xmo option. The minimum size is 8 KB.

  If scavenger is enabled, -Xms >= -Xmn + -Xmo.

  If scavenger is disabled, -Xms >= -Xmo.

-Xmx<size>
  Sets the maximum memory size (-Xmx >= -Xms)

  Examples of the use of -Xms and -Xmx:

  -Xms2m -Xmx64m
    Heap starts at 2 MB and grows to a maximum of 64 MB.
  -Xms100m -Xmx100m
    Heap starts at 100 MB and never grows.
  -Xms20m -Xmx1024m
    Heap starts at 20 MB and grows to a maximum of 1 GB.
  -Xms50m
    Heap starts at 50 MB and grows to the default maximum.
  -Xmx256m
    Heap starts at default initial value and grows to a maximum of 256 MB.
-Xnoclassgc
  Disables class garbage collection. This option switches off garbage collection of storage associated with Java classes that are no longer being used by the JVM. The default behavior is as defined by -Xclassgc. By default, class garbage collection is performed.
-Xnocompactexplicitgc
  Disables compaction on System.gc() calls. Compaction takes place on global garbage collections if you specify -Xcompactgc or if compaction triggers are met. By default, compaction is enabled on calls to System.gc().
-Xnocompactgc
  Disables compaction on all garbage collections (system or global). By default, compaction is enabled.
-Xnoloa
  Prevents allocation of a large object area; all objects are allocated in the SOA. See also -Xloa.
-Xnopartialcompactgc
  Disables incremental compaction. See also -Xpartialcompactgc.
-Xpartialcompactgc
  Enables incremental compaction. See also -Xnopartialcompactgc. By default, this option is not set, so all compactions are full.
-Xsoftmx<size> (AIX only)
  This option sets the initial maximum size of the Java heap. Use the -Xmx option to set the maximum heap size. Use the AIX DLPAR API in your application to alter the heap size limit between -Xms and -Xmx at run time. By default, this option is set to the same value as -Xmx.
-Xsoftrefthreshold<number>
  Sets the number of GCs after which a soft reference is cleared if its referent has not been marked. The default is 32, meaning that on the 32nd GC where the referent is not marked the soft reference is cleared.
-Xtgc:<arguments>
  Provides GC tracing options, where <arguments> is a comma-separated list containing one or more of the following arguments:
  backtrace
    Before a garbage collection, a single line is printed containing the name of the master thread for garbage collection, as well as the value of the osThread slot in the J9VMThread structure.
  compaction
    Prints extra information showing the relative time spent by threads in the "move" and "fixup" phases of compaction
  concurrent
    Prints extra information showing the activity of the concurrent mark background thread
  dump
    Prints a line of output for every free chunk of memory in the system, including "dark matter" (free chunks that are not on the free list for some reason, typically because they are too small). Each line contains the base address and the size in bytes of the chunk. If the chunk is followed in the heap by an object, the size and class name of the object is also printed. This argument has a similar effect to the terse argument.
  freeList
    Before a garbage collection, prints information about the free list and allocation statistics since the last GC. Prints the number of items on the free list, including "deferred" entries (with the scavenger, the unused space is a deferred free list entry). For TLH and non-TLH allocations, prints the total number of allocations, the average allocation size, and the total number of bytes discarded during allocation. For non-TLH allocations, also included is the average number of entries that were searched before a sufficiently large entry was found.
  parallel
    Produces statistics on the activity of the parallel threads during the mark and sweep phases of a global GC.
  references
    Prints extra information every time that a reference object is enqueued for finalization, showing the reference type, reference address, and referent address.
  scavenger
    Prints extra information after each scavenger collection. A histogram is produced showing the number of instances of each class, and their relative ages, present in the survivor space. The information is obtained by performing a linear walk-through of the space.
  terse
    Dumps the contents of the entire heap before and after a garbage collection. For each object or free chunk in the heap, a line of trace output is produced. Each line contains the base address, "a" if it is an allocated object, and "f" if it is a free chunk, the size of the chunk in bytes, and, if it is an object, its class name.
-Xverbosegclog[:<file>[,<X>,<Y>]]

  Causes -verbose:gc output to be written to the specified file. If the file cannot be found, -verbose:gc tries to create the file, and then continues as normal if it is successful. If it cannot create the file (for example, if an invalid filename is passed into the command), it redirects the output to stderr.

  If you specify <X> and <Y> the -verbose:gc output is redirected to X files, each containing Y GC cycles.

  The dump agent tokens can be used in the filename. See the Diagnostics Guide (http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html) section on the "Dump agent tokens" for more information. If you do not specify <file>, `verbosegc.m%d.1/31/11M%S.%pid.txt` is used.

  By default, no verbose GC logging occurs.

# Appendix B. Known limitations

Known limitations on the SDK and Runtime Environment for Linux.

You can find more help with problem diagnosis in the Diagnostics Guide at http://www.ibm.com/developerworks/java/jdk/diagnosis/50.html.

## CUPS support

The SDK and Runtime Environment for Linux does not support printing using the CUPS interface.

## XSLT namespace and Netbeans 5.0 problems

If the data provided to your transformation is a DOM that you have created programmatically, the XSLT interpreter processor might have problems with implicit namespaces. The problems are incorrect namespace declarations, or the omission of namespace declarations from the resulting document. An example Java fragment follows:

     // Example of an explicit namespace - an attribute node will be created in the DOM for xmlns='ht tp://my.org/project'
      String data = "<projectxmins='http://my.org/project/>";
      Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(n ew StringReader(data)));

     // Example of an implicit namespace - no attribute node is created for the implicit namespace xm lns='http://your.org/project
      Element typeElem = doc.createElementNS("http://your.org/project", "type");
      doc.getDocumentElement().appendChild(typeElem);

To work around this limitation you can use the XSLT compiler processor, XSLTC. You can specify the compiler processor by using the -XSLTC option with the Process command or by setting the javax.xml.transform.TransformerFactory service provider to org.apache.xalan.xsltc.trax.TransformerFactoryImpl.

Netbeans 5.0 does not run under the JVM with default settings. To enable Netbeans to run, set the javax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl property in `jre/lib/jaxp.properties`.

## BIOS settings on AMD64 SMP systems

The Node memory interleaving BIOS setting must be set to `DISABLED`. Otherwise, unpredictable results might occur, including Java crashes and hangs. This instruction is in accordance with recommendations from AMD.

## JConsole monitoring tool Local tab

In the IBM JConsole tool, the Local tab, which allows you to connect to other Virtual Machines on the same system, is not available. Also, the corresponding command line pid option is not supported. Instead, use the Remote tab in JConsole to connect to the Virtual Machine that you want to monitor. Alternatively, use the connection command-line option, specifying a host of `localhost` and a port number. When you start the application that you want to monitor, set these command-line options:

-Dcom.sun.management.jmxremote.port=<value>
  Specifies the port the management agent listens on.
-Dcom.sun.management.jmxremote.authenticate=false
  Disables authentication unless you have created a user name file.
-Dcom.sun.management.jmxremote.ssl=false
  Disables SSL encryption.

## JConsole monitoring tool when the JIT is not enabled

The IBM JConsole tool has the following limitations when the JIT is not enabled:

- The Summary tab is not available.
- The VM tab is not available.
- The chart accessed from the Memory tab is not updated.
- The chart accessed from the Threads tab is not updated.
- You cannot determine if the Perform GC button has an effect when accessed from the Memory tab.

## GUI applications, such as the JConsole monitoring tool, on 64-bit Ubuntu with a 32-bit JVM

When running a 32-bit JVM on a 64-bit Ubuntu system, GUI applications do not start because some AWT libraries are missing. To fix the problem, install the 32-bit libraries using the ia32-libs package:

    sudo apt-get install ia32-libs

The following exception is thrown if the libraries are not available:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: awt (An exception was pending after running JNI_OnLoad)
            at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:993)
            at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:962)
            at java.lang.System.loadLibrary(System.java:465)
            ... lines removed for clarity ...

If problems are encountered with DNS name resolution, install the package lib32nss-mdns.

## Incorrect stack traces when loading new classes after an Exception is caught

If new classes are loaded after an Exception has been caught, the stack trace contained in the Exception might become incorrect. The stack trace becomes incorrect if classes in the stack trace are unloaded, and new classes are loaded into their memory segments.

## Web Start and Java 1.3 applications

The IBM SDK for Linux, v5.0 Web Start does not support launching Java 1.3 applications.

## Slow DSA key pair generation

Creating DSA key pairs of unusual lengths can take a significant amount of time on slow machines. Do not interpret the delay as a stop or endless loop, because the process finishes if sufficient time is allowed. The DSA key generation algorithm has been optimized to generate standard key lengths (for instance, 512, 1024) more quickly than others.

## Creating a JVM using JNI

Native programs cannot create a VM with JNI_VERSION_1_1(0x00010001) interfaces. You cannot call JNI_CreateJavaVM() and pass it a version of JNI_VERSION_1_1(0x00010001). The versions that can be passed are:

- JNI_VERSION_1_2(0x00010002)
- JNI_VERSION_1_4(0x00010004)

The VM created is determined by the Java libraries present (that is, 1.2.2, 1.3.x, 1.4.x, 5.x), not the one that is implied by the JNI interface version passed.

The interface version does not affect any area of VM behavior other than the functions available to native code.

## Window managers and keyboard shortcuts

Your window manager might override some of the Java keyboard shortcuts. If you need to use an overridden Java keyboard shortcut, consult your operating system manual and change your window manager keyboard shortcuts.

## X Window System file descriptors

The X Window System is unable to use file descriptors above 255. Because the JVM holds file descriptors for open jar files, X can run out of file descriptors. As a workaround, you can set the JAVA_HIGH_ZIPFDS environment variable to tell the JVM to use higher file descriptors for jar files.

To use the JAVA_HIGH_ZIPFDS environment variable, set it to a value in the range 0 - 512. The JVM then opens the first jar files using file descriptors up to 1024. For example, if your program is likely to load 300 jar files:

`export JAVA_HIGH_ZIPFDS=300`

The first 300 jar files are then loaded using the file descriptors 724 - 1023. Any jar files opened after that are opened in the typical range.

## DBCS and the KDE clipboard

You might not be able to use the system clipboard with double-byte character set (DBCS) to copy information between Linux applications and Java applications if you are running the K Desktop Environment (KDE).

## Upgrading packages distributed by Red Hat

During installation, if you have already installed an earlier version of this product that was distributed by Red Hat, the Red Hat Package Manager (RPM) reports that the IBM package is older than any versions of the product that Red Hat has distributed. This condition occurs because Red Hat adds a "serial number" to the RPM package. The serial number overrides the version scheme of the product in the package. By default, RPM refuses to install a package that seems to be older than one already installed. The --oldpackage option of the rpm command enables you to install the new IBM package.

## Limit on threads using the LinuxThreads library

On RHEL3, SLES9, and newer distributions, the default threading library is NPTL, which implements Java threads as native threads. On earlier distributions, the default threading library is LinuxThreads, which implements threads as new processes. If the number of Java threads exceeds the maximum number of processes allowed, your program might stop.

The maximum number of threads available is determined by the lowest of:

- The user processes setting (ulimit -u) in `/etc/security/limits.conf`
- The limit that is defined in `/proc/sys/kernel/threads_max`
- The limit PTHREAD_THREADS_MAX that is defined in `libpthreads.so` (changing this value requires `glibc` to be recompiled)

However, you might run out of virtual storage before you reach the maximum number of threads.

## ThreadMXBean Thread User CPU Time limitation

In package java.lang.management, the methods ThreadMXBean.getThreadUserTime() and ThreadMXBean.getCurrentThreadUserTime() are not supported. These methods always return -1. These methods are not supported even when ThreadMXBean.isThreadCpuTimeSupported() and ThreadMXBean.isCurrentThreadCpuTimeSupported() return true. This limitation does not affect ThreadMXBean.getThreadCpuTime() or ThreadMXBean.getCurrentThreadCpuTime()

## KeyEvents and window managers

KeyEvent results that include the Alt key might differ between window managers in Linux. They also differ from results of other operating systems. When using the default settings, Ctrl+Alt+A in the KWin window manager produces a KeyEvent, whereas Ctrl+Alt+A in the Metacity window manager does not produce a key event.

## The X Window System and the Meta key

On the Linux X Window System, different key codes are generated when certain keys are pressed at the same time. For example, the key code 64 is returned when you press Alt_L or Meta_L. Similarly, the key code 113 is returned when you press Alt_R or Meta_R. You can check the exact values by typing the following instruction at a shell prompt:

    xmodmap -pk

With these default settings, the SDK considers that the Meta and Alt keys are pressed together. As a workaround, remove the Meta_x mapping by typing the following instruction at a shell prompt:

    xmodmap -e "keysym Alt_L = Alt_L" -e "keysym Alt_R = Alt_R"

This workaround might affect other X Window System applications that are running on the same display if they use the Meta-key that was removed.

## SIGSEGV when creating a JVM using JNI

A call to JNI_CreateJavaVM() from a JNI application might cause a segmentation fault (signal SIGSEGV); to avoid this fault, rebuild your JNI program specifying the option -lpthread.

## Traditional Chinese input and the Enter, Space, Backspace, and Esc keys

For users of Traditional Chinese only, function keys Enter, Space, Backspace, and Esc do not work as expected when using the LinYi ZhuYin, YiTian ZhuYin, and Bosham IMEs to enter the TCH characters. The Enter key inserts a new line, the Esc key is used to cancel the preedit strings or the candidate window, and the Space key inserts a space. The candidate window disappears after the commit key has been pressed and it does not come back when you press the Backspace key while using the LinYi ZhuYin, YiTian ZhuYin, and Bosham IMEs to enter the Traditional Chinese characters.

## Lack of resources with highly threaded applications

If you are running with many concurrent threads, you might get a warning message:

    java.lang.OutOfMemoryError

The message is an indication that your machine is running out of system resources and messages can be caused by the following reasons:

- If your Linux installation uses LinuxThreads, rather than NPTL, the number of processes created exceeds your user limit.
- Not enough system resources are available to create new threads. In this case, you might also see other Java exceptions, depending on what your application is running.
- Kernel memory is either running out or is fragmented. You can see corresponding Out of Memory kernel messages in `/var/log/messages`. The messages are associated with the ID of the killed process.

Try tuning your system to increase the corresponding system resources.

## JDBC-ODBC bridge

Linux IA32, PPC32, and zSeries 31-bit only

The JDBC-ODBC bridge driver shipped with these platforms is unsupported.

## X Server and client font problems

When running a Java AWT or Swing application on a Linux machine and exporting the display to a second machine, you might experience problems displaying some dialogs if the set of fonts loaded on the X client machine is different from the set loaded on the X server machine. This problem is noticeable particularly with SLES8 in Chinese locales, where the default installation of the server version installs arphic fonts, but the default installation of the client does not. To avoid this problem, install the same fonts on both machines.

## UTF-8 encoding and MalformedInputExceptions

If your system locale is using a UTF-8 encoding, some tools might throw a sun.io.MalformedInputException. To find out whether your system is using a UTF-8 encoding, examine the locale-specific environment variables such as LANG or LC_ALL to see if they end with the ".UTF-8" suffix. If you get the warning sun.io.MalformedInputException, change characters that are not in the 7-bit ASCII range (0x00 - 0x7f) and are not represented as Java Unicode character literals to Java Unicode character literals (for example: '\u0080'). You can also work around this problem by removing the ".UTF-8" suffix from the locale-specific environment variables; for example, if your machine has a default locale of "en_US.UTF-8", set LANG to "en_US".

Some distributions of Red Hat, including Red Hat 9 and RHEL3, use UTF-8 encoding by default.

## AMI and xcin problems when exporting displays

If you are using AMI and xcin in a cross-platform environment, there might be a problem if you try to export the display between a 32-bit and a 64-bit system, or between a big-endian and a little-endian system. If you have this problem, upgrade to the latest version of AMI and xcin.

## RHEL3 and Chinese Characters in AWT

On Red Hat Enterprise Linux 3, Chinese characters might not be displayed in AWT text components except for GB2312 characters in the Chinese GB18030 locale.

## RHEL3 and miniChinput

64-bit platforms only

On Red Hat Enterprise Linux 3 with miniChinput (Simplified Chinese XIM server), you might experience unexpected behavior. Contact Red Hat for guidance, at http://www.redhat.com. See Red Hat Bugzilla number RIT75701.

## RHEL4 and XIM

For Chinese, Korean and Japanese language users of RHEL4 only.

No XIM server is installed by default. To enter DBCS characters to a Java application, install a XIM server package such as iiimf-x or kinput2.

## RHEL4 and IIIMF

For Chinese, Korean, and Japanese language users of RHEL4 only.

If you are using the Internet/Intranet Input Method Framework (IIIMF), use IIIMF packages that are included in Red Hat Enterprise Linux 4 Update 2 or later. Contact Red Hat for guidance, at http://www.redhat.com.

(zSeries 64-bit only) You might experience IIIMF failures or a failure to start. To resolve the problem, upgrade to the latest IIIMF packages.

(Traditional Chinese on PPC, s390, or s390x only) IIIMF might not work. To resolve the problem, use `iiimf-le-xcin-0.1.7-13.EL4` or later.

(Simplified Chinese on PPC, s390, or s390x only) IIIMF might not work correctly. To resolve the problem, use IIMF packages included in RHEL4 Update 5 or later.

## RHEL4 and the zh_CN.GB18030 locale

Simplified Chinese language users of RHEL4 only.

The zh_CN.GB18030 locale is not supported by xlib in RHEL4. xterm cannot activate Input Method Server to enter GB18030 characters. Use the zh_CN.UTF8 locale instead. If you have existing programs or data encoded with GB2312, GBK, or GB18030, and you want to migrate them to RHEL4, you must preprocess them with iconv to convert them to UTF-8 encoding so that the programs can run and data can be displayed properly in RHEL4 with the zh_CN.UTF8 locale.

This limitation is resolved in RHEL4 U3.

## RHEL4 and xcin

You might experience hangs with xcin on RHEL4. To resolve the problem, set ICCHECK_DISABLE to YES in the `/etc/chinese/xcin/xcinrc` file.

64-bit environments only

On RHEL4 with xcin (Traditional Chinese XIM server), you might experience unexpected behavior such as a segmentation fault with Java on 64-bit environments (such as AMD64 or zSeries 64-bit platforms). To resolve the problem, upgrade to the latest xcin package.

## RHEL4 and IIIMF focus change problems

RHEL4 only.

When using IIIMF (Internet Intranet Input Method Framework) to enter DBCS characters, you might encounter focus change problems. The problem occurs when minimizing active input components. After restoring the component, the input method will switch back to SBCS. DBCS must then be manually reactivated.

The following components have this focus change problem:

- java.awt.Canvas
- java.awt.Button
- javax.swing.JButton
- javax.swing.JSplitPane
- javax.swing.JComboBox
- javax.swing.JList

## XIM and the Java Plug-in

RHEL3, RHEL4, and SLES9 only

For Japanese, Chinese, and Korean language users, you cannot use XIM to enter your own characters into text components on a Java applet in a Web browser. This limitation occurs because XEmbed requires a fix to the X11 library file. To work around this situation, specify the -Dsun.awt.noxembed=true system parameter to disable XEmbed. You can set this option by using the control panel:

1. Open the Java Plug-in control panel and go to the Java tab.
2. Click the View button in the Java Applet Runtime Settings.
3. Enter -Dsun.awt.noxembed=true in the Java Runtime Parameters and click OK.
4. Click Apply.
5. Start a browser.

This limitation is resolved in RHEL4 U3, RHEL3 U7, and SLES9 SP3.

## SLES10 and Motif AWT

Japanese locales only

On SLES10, using Motif AWT, you might need to install the `baekmuk-ttf` and `ttf-founder-simplified` rpm packages to display NEC selected and IBM extension characters.

## Arabic characters and Matrox video cards

Intel 32-bit platforms only

For Arabic text users, when using Linux with a Matrox video card and acceleration enabled, distortion of characters can be seen when using drawString to display large fonts. This problem is caused by the driver for those cards. The suggested workaround is to disable acceleration for the device.

## SLES9 NPTL and the parallel port driver

Intel 32-bit platforms only

On SLES 9 NPTL, the parallel port driver causes a kernel failure and brings down a Java thread. The JVM detects the failure when it tries to suspend the thread for Garbage Collection and then stops, producing a core file and the message "JVMLH030: threads are disappearing when trying to suspend all threads".

SUSE Bugzilla report 47947 is raised against this problem. This bug is fixed in SLES 9 Service Pack 1.

## JNI calls with more than eight parameters on PPC platforms

PPC platforms only

If your Java code uses JNI calls, and any specific call has more than eight float or double parameters, your C code must be compiled with the gcc-2.95.3 Free Software Foundation (FSF) level of GNU C Compiler (GCC).

## XFree86 version 3.x

PPC platforms only

If you are running XFree86 version 3.x, you might receive a SIGSEGV error. To avoid this problem, it is recommended that you use XFree86 version 4.x.

## Parallel port operations on SLES9 before SP2

PPC platforms only

The JavaComm package cannot support parallel port operations on the SLES 9 GA and SP1 kernels. This limitation is resolved in the SP2 kernel. The SUSE Bugzilla number is 50028.

## SELinux and the Java -version option

You must install selinux-policy-2.4.6-214.e15 or later to use the -version option with SELinux enabled. Alternatively, if you are unable to use the -version option with SELinux enabled, try the command: `restorecon -R -v /opt/ibm`. If the policy version is incorrect, the message "Error loading: /opt/ibm/java2-ppc64-50/jre/bin/classic/libjvm.so: cannot restore segment prot after reloc: Permission denied" is produced. The Bugzilla number is 50763.

## Compiling libFileStat.so on PPC 64-bit platforms

PPC 64-bit platforms only

The default gcc cross compiler (version 3.2-49) causes several errors. To generate the shared library `libFileStat.so`, run:

    /opt/cross/bin/powerpc64-linux-gcc -shared -o libFileStat.so -I<SDK_PATH>/include FileStat.c

where <SDK_PATH> is the path to the installed SDK directory.

## IPv6 on zSeries platforms

zSeries platforms only

Although the Linux kernel in the current distributions provides support for Internet Protocol version 6 (IPv6), you might encounter problems using it. Support for IPv6 from Java is included in this release, but you are advised to turn off the support with the -Djava.net.preferIPv4Stack=true option on the java command. If you install a kernel that fully supports IPv6, you do not need this option.

## xcin on 64-bit zSeries platforms

zSeries 64-bit platforms only

The Chinese and Taiwanese input method server (xcin) has not been tested.

## GTK Look and Feel

To use the GTK Look and Feel on a GNOME desktop you must set the system property -Dsun.desktop=gnome.

## NullPointerException with the GTK Look and Feel

DBCS environments only

If your application fails with a NullPointerException using the GTK Look and Feel, unset the GNOME_DESKTOP_SESSION_ID environment variable.

## Unreadable characters on Swing components on Ubuntu

On Ubuntu systems configured for Chinese, Japanese, or Korean globalization, some characters on Java Swing components might not be readable because the font is unclear when anti-aliasing is not used. To improve the readability of the characters, set the swing.aatext property in the java or javaw command as follows:

    -Dswing.aatext=true

Alternatively, use the IBM_JAVA_OPTIONS environment variable to specify this property.

## Linux Completely Fair Scheduler affects Java performance

Java applications that use synchronization extensively might perform poorly on Linux distributions that include the Completely Fair Scheduler. The Completely Fair Scheduler (CFS) is a scheduler that was adopted into the mainline Linux kernel as of release 2.6.23. The CFS algorithm is different from the scheduling algorithms for previous Linux releases. It might change the performance properties of some applications. In particular, CFS implements sched_yield() differently, making it more likely that a yielding thread is given CPU time regardless.

If you encounter this problem, you might observe high CPU usage by your Java application, and slow progress through synchronized blocks. The application might appear to stop because of the slow progress.

There are two possible workarounds:

- Invoke the JVM with the additional argument -Xthr:minimizeUserCPU.
- Configure the Linux kernel to use a heuristic for sched_yield() that is more compatible with earlier versions, by setting the sched_compat_yield tunable kernel property to 1. For example:

      echo "1" > /proc/sys/kernel/sched_compat_yield

Do not use these workarounds unless you are experiencing poor performance.

This problem might affect IBM Developer Kit and Runtime Environment for Linux 5.0 (all versions) and 6.0 (all versions up to and including SR 4) running on Linux kernels that include the Completely Fair Scheduler. For IBM Developer Kit and Runtime Environment for Linux version 6.0 after SR 4, the use of CFS in the kernel is detected and the option -Xthr:minimizeUserCPU enabled automatically. Some Linux distributions that include the Completely Fair Scheduler are Ubuntu 8.04 and SUSE Linux Enterprise Server 11.

More information about CFS can be found at Multiprocessing with the Completely Fair Scheduler.

## Java 5 does not support the compiz 3D-enabled window manager on Ubuntu 8.04

You must use the "metacity" window manager instead of "compiz". To turn off compiz, set Visual Effects to None, by following these steps: System -> Preferences -> Appearance -> Visual Effects

On the Visual Effects tab, select the None option, then close the window.

## Using -Xshareclasses:destroy during JVM startup

When running the command java -Xshareclasses:destroy on a shared cache that is being used by a second JVM during startup, you might have the following issues:

- The second JVM fails.
- The shared cache is deleted.

# Notices

This information was developed for products and services offered in the U.S.A.

IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local IBM representative for information on the products and services currently available in your area. Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent product, program, or service that does not infringe any IBM intellectual property right may be used instead. However, it is the user's responsibility to evaluate and verify the operation of any non-IBM product, program, or service.

IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not grant you any license to these patents. You can send license inquiries, in writing, to:

- IBM Director of Licensing
- IBM Corporation
- North Castle Drive
- Armonk, NY 10504-1758
- U.S.A.

For license inquiries regarding double-byte character set (DBCS) information, contact the IBM Intellectual Property Department in your country or send inquiries, in writing, to:

- Intellectual Property Licensing
- Legal and Intellectual Property Law
- IBM Japan Ltd.
- 1623-14, Shimotsuruma, Yamato-shi
- Kanagawa 242-8502 Japan

The following paragraph does not apply to the United Kingdom or any other country where such provisions are inconsistent with local law:

INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you.

This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time without notice.

Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk.

IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring any obligation to you.

Licensees of this program who wish to have information about it for the purpose of enabling: (i) the exchange of information between independently created programs and other programs (including this one) and (ii) the mutual use of the information which has been exchanged, should contact:

- JIMMAIL@uk.ibm.com
- [Hursley Java Technology Center (JTC) contact]

Such information may be available, subject to appropriate terms and conditions, including in some cases, payment of a fee.

The licensed program described in this document and all licensed material available for it are provided by IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement or any equivalent agreement between us.

Any performance data contained herein was determined in a controlled environment. Therefore, the results obtained in other operating environments may vary significantly. Some measurements may have been made on development-level systems and there is no guarantee that these measurements will be the same on generally available systems. Furthermore, some measurements may have been estimated through extrapolation. Actual results may vary. Users of this document should verify the applicable data for their specific environment.

Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products.

All statements regarding IBM's future direction or intent are subject to change or withdrawal without notice, and represent goals and objectives only.

COPYRIGHT LICENSE:

This information contains sample application programs in source language, which illustrate programming techniques on various operating platforms. You may copy, modify, and distribute these sample programs in any form without payment to IBM, for the purposes of developing, using, marketing or distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. The sample programs are provided "AS IS", without warranty of any kind. IBM shall not be liable for any damages arising out of your use of the sample programs.

Each copy or any portion of these sample programs or any derivative work, must include a copyright notice as follows:

© (your company name) (year). Portions of this code are derived from IBM Corp. Sample Programs. © Copyright IBM Corp. _enter the year or years_.

If you are viewing this information softcopy, the photographs and color illustrations may not appear.

## Trademarks

IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked terms are marked on their first occurrence in this information with a trademark symbol (® or ™), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at http://www.ibm.com/legal/copytrade.shtml.

Intel is a trademark of Intel Corporation in the United States, other countries, or both.

Linux is a trademark of Linus Torvalds in the United States, other countries, or both.

UNIX is a registered trademark of The Open Group in the United States and other countries.

Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

Other company, product, or service names may be trademarks or service marks of others.