Skip to main content


developerWorks  >   Java™ technology  >   IBM Developer kits  >   Linux  >   SDK and Runtime Guide  >  

Linux

developerWorks


SDK and Runtime Guide

IBM SDK for Linux platforms, Java Technology Edition

SDK and Runtime Guide

Version 6

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

Contents

| |

Preface

This user guide provides general information about the IBM(R) SDK and Runtime Environment for Linux(R) platforms, Java(TM) Technology Edition, Version 6 and specific information about any differences in the IBM implementation compared with the Sun implementation.

Read this user guide in conjunction 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/tested.html.

(Intel(R) 32-bit platforms only) These Virtualized Environments are supported:

  • VMWare
  • Xen
  • Microsoft(R) 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, in red with vertical bars to the left of |the changes when viewing in HTML or in a color-printed copy, or by vertical |bars to the left of the changes when viewing as a PDF.

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 6 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 Using the 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.

Conventions

Throughout this user guide the default installation directory of the SDK is referred to as /opt/ibm/java-<arch>-60/, 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/java-<arch>-60/:

  • Linux IA 32-bit: /opt/ibm/java-i386-60/
  • Linux AMD 64-bit: /opt/ibm/java-x86_64-60/
  • Linux PPC 32-bit: /opt/ibm/java-ppc-60/
  • Linux PPC 64-bit: /opt/ibm/java-ppc64-60/
  • Linux System z(TM) 31-bit: /opt/ibm/java-s390-60/
  • Linux System z 64-bit: /opt/ibm/java-s390x-60/

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, v6. 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/javase/6/webnotes/compatibility.html

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(R) Application Server), and you upgrade from a previous level of the SDK, perhaps v5.0, serialized classes might not be compatible. However, classes are compatible between service refreshes.

Migrating from other IBM JVMs

From Version 5.0, the IBM Runtime Environment for Linux contains new versions 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:

  • The JVM shared library libjvm.so is now stored in jre/lib/<arch>/j9vm and jre/lib/<arch>/classic.
  • From Version 5.0 onwards, the JVM Monitoring Interface (JVMMI) is no longer available. You must rewrite JVMMI applications 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/javase/6/docs/technotes/guides/jvmti/ and the Diagnostics Guide.
  • From Version 5.0 onwards, the implementation of JNI conforms to the JNI specification, but differs from the Version 1.4.2 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 Appendix A. Nonstandard options.
  • From Version 5.0 onwards, 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 output have changed. You must change any programs that process the verbose GC output so that they will 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 Version 5.0 onwards, these are included in a file called vm.jar.
  • From Version 6, JVM classes are held in multiple JAR files in the jre/lib directory. This replaces the single rt.jar and core.jar from earlier releases.
  • For additional industry compatibility information, see Sun's Java 6 Compatibility Documentation: http://java.sun.com/javase/6/webnotes/compatibility.html
  • For additional deprecated API information, see Sun's Java 6 Deprecated API List: http://java.sun.com/javase/6/docs/api/deprecated-list.html
  • Tracing class dependencies, invoked using -verbose:Xclassdep, is not supported. If you specify -verbose:Xclassdep, the JVM will issue an error message and will not start.

Supported hardware for System z

The System z 31-bit and 64-bit SDKs and Runtime Environments run on System z9(TM) and zSeries(R) 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, and the accompanying license, copyright files, javadoc, and demo directory 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 are the compiled class files for the platform and must remain zipped 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. The IBM Runtime Environment for Java contains an expired GTE CyberTrust Certificate for compatibility reasons. This certificate will be removed for Version 7 of the SDK. See http://www.ibm.com/support/docview.wss?uid=swg21225464 for more information.
  • JRE tools - The following tools are part of the Runtime Environment and are in the /opt/ibm/java-<arch>-60/jre/bin directory unless otherwise specified.
    ikeyman (iKeyman GUI utility)
    Allows you to manage keys, certificates, and certificate requests. For more information see the accompanying Security Guide and http://download.boulder.ibm.com/ibmdl/pub/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.
    jcontrol (Java Control Panel)
    (Except System z platforms) Configures your Runtime Environment.
    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.
    kinit
    Obtains and caches Kerberos ticket-granting tickets.
    klist
    Displays entries in the local credentials cache and key table.
    ktab
    Manages the principal names and service keys stored in a local key table.
    pack200
    Transforms a JAR file into a compressed pack200 file using the Java gzip compressor.
    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.
    unpack200
    Transforms a packed file produced by pack200 into a JAR file.

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/java-<arch>-60/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.
ControlPanel (Java Control Panel)
(Except System z platforms) Configures your Runtime Environment.
extcheck (Extcheck utility)
Detects version conflicts between a target jar file and currently-installed extension jar files.
(Linux IA 32-bit, PPC32, and PPC64 only) 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.
ikeycmd (iKeyman command-line utility)
Allows you to manage keys, certificates, and certificate requests from the command line. For more information see the accompanying Security Guide and http://www.ibm.com/developerworks/java/jdk/security.
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 (Java Interpreter)
Runs Java classes. The Java Interpreter runs programs that are written in the Java programming language.
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.
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.
jconsole (JConsole Monitoring and Management Tool)
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.
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.
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.
policytool (Policy File Creation and Management Tool)
Creates and modifies the external policy configuration files that define your installation's Java security policy.
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.
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.
schemagen
Creates a schema file for each namespace referenced in your Java classes.
serialver (Serial Version Command)
Returns the serialVersionUID for one or more classes in a format that is suitable for copying into an evolving class.
tnameserv (Common Object Request Broker Architecture (CORBA) transient naming service)
Starts the CORBA transient naming service.
wsgen
Generates JAX-WS portable artifacts used in JAX-WS web services.
wsimport
Generates JAX-WS portable artifacts from a WSDL file.
xjc
Compiles XML Schema files.
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. From Version 6, the RMI-IIOP demo is not included with the SDK.
copyright
The copyright notice for the SDK for Linux software.
License

The License file, /opt/ibm/java-<arch>-60/docs/content/<locale>/LA_<locale>, 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.

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 machine 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/java-<arch>-60/. 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.

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).

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:

  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).

In RHEL 5, these RPMs contain the shared libraries:

  • compat-libstdc++-33-3.2.3 (Platforms other than zSeries)
  • compat-libstdc++-296-2.95.3 (zSeries)

To include these libraries during RHEL 5 installation:

  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

|You can run the IBM SDK for Java on |Red Hat Enterprise Linux Version 5, with SELinux enabled, on IA32 or AMD64 |platforms without any restrictions. For other platforms, Java must |be installed in the default directory or you must enable it manually.

If Java is not installed in the default directory, 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 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.

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 an RPM file

A procedure for installing from an RPM file.

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 or install the JVM from the .tgz file.

  1. Open a shell prompt, making sure you are root.
  2. At a shell prompt, type rpm -ivh <RPM file>. For example:
    rpm -ivh ibm-java-<arch>-sdk-6.0-0.0.<arch>.rpm
    or
    rpm -ivh ibm-java-<arch>-jre-6.0-0.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.

  1. Create a directory to store the Java package files. The examples in this guide assume that you have installed in /opt/ibm/java-<arch>-60/. In the rest of the guide, replace /opt/ibm/java-<arch>-60/ with the directory in which you installed Java.
  2. At a shell prompt, type tar -zxvf <.tgz file>.
    tar -zxvf ibm-java-sdk-60-linux-<arch>.tgz
    or
    tar -zxvf ibm-java-jre-60-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/java-<arch>-60/jre
    chcon -R -t texrel_shlib_t /opt/ibm/java-<arch>-60/bin
    chcon -R -t texrel_shlib_t /opt/ibm/java-<arch>-60/lib

Using a JPackage compatible format

The IBM SDK for Linux, v6 is also available in a JPackage compatible format.

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 will not be installed in the default location. See |the "Directory Structure" section of the JPackage Java(TM) 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-utils version 1.5.38 or above is required to install the IBM SDK for Linux, v6.

|JPackage is not supported on SLES9 or SLES10 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.

The PATH environment variable enables Linux to find programs and utilities, such as javac, java, and javadoc, 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/java-<arch>-60/bin:/opt/ibm/java-<arch>-60/jre/bin:$PATH
  2. Log on again or run the updated shell script to activate the new PATH environment variable.

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 javadoc, where to find the Java class libraries.

You need to 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.

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.

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

  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-java-<arch>-jre-6.0-0.0.<arch>
    ibm-java-<arch>-sdk-6.0-0.0.<arch>

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

    rpm -e ibm-java-<arch>-jre-6.0-0.0.<arch>
    rpm -e ibm-java-<arch>-sdk-6.0-0.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, v6 that was extracted from the compressed package.

  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 AMD64/EM64T 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 launch 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 dialog box with error information if a launch 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 invoke. 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. You can also obtain version information for all jar files on the class path by using the -Xjarversion option.

  1. Open a shell prompt.
  2. Type the following command:
    java -version
    You will see information similar to:
    java version "1.6.0-internal"
    Java(TM) SE Runtime Environment (build 20070329_01)
    IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260-20070326_12091 (JIT enabled)
    J9VM - 20070326_12091_lHdSMR
    JIT  - dev_20070326_1800
    GC   - 20070319_AA)
    Exact build dates and versions will change.

You can also list the version information for all available jar files on the class path, the boot class path, and in the extensions directory. Type the following command:

java -Xjarversion

You will see information similar to:

...
/opt/ibm/java-<arch>-60/jre/lib/ext/ibmpkcs11impl.jar  VERSION: 1.0 build_20070125
/opt/ibm/java-<arch>-60/jre/lib/ext/dtfjview.jar
/opt/ibm/java-<arch>-60/jre/lib/ext/xmlencfw.jar  VERSION: 1.00, 20061011  LEVEL: -20061011

...

The information available varies for each jar file and is taken from the Implementation-Version and Build-Level properties in the manifest of the jar file.

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.

These methods of specifying Java options are listed in order of precedence:

  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"

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.

Standard options

The definitions for the standard options.

See Appendix A. Nonstandard 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.
-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>
Enables verbose output. 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 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 v6 compiler delivers new optimizations as a result of compiler research, improves optimizations implemented in previous versions of the JIT, and provides better hardware exploitation.

Both the IBM SDK and Runtime Environment include the JIT, which is enabled by default in user applications and SDK tools. Normally, you do not invoke 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.

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

  • 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.

  • 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 shell prompt, enter:
    unset JAVA_COMPILER
  • Use the -D option on the JVM command line to set the java.compiler property to jitc. At a shell 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 shell prompt, enter:
    java -Xjit <class>

Determining whether the JIT is enabled

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

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)

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 within 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