IBM 32-bit Runtime Environment for Linux on Intel architecture, Java 2 Technology Edition, Version 1.4.0; User Guide


Copyright information

Note: Before using this information and the product it supports, be sure to read the general information under Notices.

This edition of the User Guide applies to IBM 32-bit Runtime Environment for Linux on Intel architecture, Java 2 Technology Edition, Version 1.4.0, and to all subsequent releases and modifications until otherwise indicated in new editions.

(c) Copyright Sun Microsystems, Inc. 1997, 2002, 901 San Antonio Rd., Palo Alto, CA 94303 USA. All rights reserved.

(c) Copyright International Business Machines Corporation, 1999, 2002. All rights reserved.

U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.


Preface

The IBM(R) 32-bit Runtime Environment for Linux on Intel architecture, Java(TM) 2 Technology Edition, Version 1.4.0 contains the Java Virtual Machine (JVM), core Sun Microsystems Java classes, and supporting files. The Runtime Environment does not contain all the classes found in the SDK package.

The User Guide provides general information about the Runtime Environment and specific information about any differences in the IBM implementation of the Runtime Environment 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 for Linux has been tested, see: http://www-106.ibm.com/developerworks/java/jdk/linux/tested.html

Note that the Runtime Environment for Linux is a subset of the SDK and enables you only to run Java applications. If you have installed the SDK for Windows, the Runtime Environment is included.

The terms "Runtime Environment" and "Java Virtual Machine" are used interchangeably throughout this User Guide.

Technical changes for this 1.4.0 User Guide, other than minor or obvious ones such as updating "1.3.1" to "1.4.0", are indicated in red when viewing in HTML or in a color-printed copy and by vertical bars to the left of the changes.


Contents

Copyright information

Preface

Overview

  • Version compatibility
  • Files included with the Runtime Environment for Linux
  • License agreement
  • The just-in-time (JIT) compiler
  • The Native Method Interface and the Java Native Interface
  • Configuring the Runtime Environment for Linux

  • Installing on Red Hat
  • Uninstalling the Runtime Environment for Linux

  • Uninstalling the installable Red Hat Package Manager (RPM) package
  • Uninstalling the compressed Tape Archive (TAR) package
  • Launching a Java application

  • Summary of commands
  • Options
  • Standard options
  • Non-standard options
  • |Globalization of the java command
  • |Working with classpaths
  • Working with the bootclasspath
  • Specifying garbage collection policy
  • Pause time
  • Pause time reduction
  • Environments with very full heaps
  • Further information about garbage collection
  • Obtaining the IBM build and version number

    |Using the Java Plug-in

  • |Installing and configuring the Java Plug-in
  • |Installing the Java Plug-in for Mozilla
  • |Supported browsers
  • |Using DBCS parameters
  • |Using Web Start

  • |Installing Web Start
  • Working with floating stacks

    |Switching the input method in DBCS languages

    Runtime example

    Installing your application on a user's system

    Known limitations

    Notices

  • Trademarks

  • Overview

    The Runtime Environment for Linux contains the subset of classes required to create a Java runtime environment and to run Java programs. It also contains the Java Virtual Machine, Java classes, and supporting files. The Runtime Environment for Linux contains only a subset of the classes found in the SDK.


    Version compatibility

    |There is no guarantee that 1.4 compiled classes will work on |pre-1.4.0 Runtime Environment releases.


    Files included with the Runtime Environment for Linux

    The Runtime Environment for Linux includes non-debuggable .so files and class files needed to support a program at runtime. The Runtime Environment for Linux does not include any of the development tools, such as appletviewer or javac, or classes that would pertain only to a development system.

    In addition, the Java Communications application programming interface (API) package is provided for use with the Runtime Environment for Linux.


    License agreement

    The LICENSE_xx.html file contains the license agreement for the Runtime Environment for Linux software. (xx is an abbreviation for the language.)

    To view or print the license agreement, open the file in a Web browser.


    The just-in-time (JIT) compiler

    The just-in-time (JIT) compiler (libjitc.so) dynamically generates machine code for frequently used bytecode sequences in a Java application or applet while it is running.

    The Runtime Environment for Linux includes the JIT compiler (libjitc.so), which is enabled by default. You can disable the JIT to help isolate a problem with a Java application, an applet, or the compiler itself.

    To disable the JIT, at a shell prompt in the window where you will run the application, type:

        export JAVA_COMPILER=NONE
    

    To enable the JIT, type at the shell prompt:

        export JAVA_COMPILER=jitc
    

    To verify whether or not the JIT is enabled, type at a shell prompt:

        java -version
    

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

    (JIT enabled: jitc)
    

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

    (JIT disabled)
    


    The Native Method Interface and the Java Native Interface

    IBM does not support the Native Method Interface in this release. Do not use this interface in your applications.

    The Java Native Interface (JNI) is included with the Runtime Environment. For information about using the JNI, see the Sun Web site: http://java.sun.com.


    Configuring the Runtime Environment for Linux

    After you install the Runtime Environment for Linux, edit your shell script and add this directory to your PATH statement:

    /opt/IBMJava2-14/jre/bin

    If you installed the Runtime Environment for Linux in a directory other than /opt/IBMJava2-14/, replace /opt/IBMJava2-14/ with the directory in which you installed the Runtime Environment for Linux.


    Installing on Red Hat

    When you are installing on a Red Hat system, to allow the font server to find the Java TrueType fonts, run:

    su root 
    /usr/sbin/chkfontpath --add /opt/IBMJava2-14/jre/lib/fonts
    

    You must do this at install time and you must be root to run the command.


    Uninstalling the Runtime Environment for Linux

    The process you use to remove the Runtime Environment for Linux depends on whether you installed the installable Red Hat Package Manager (RPM) package or the compressed Tape Archive (TAR) package. See Uninstalling the installable Red Hat Package Manager (RPM) package or Uninstalling the compressed Tape Archive (TAR) package for instructions.


    Uninstalling the installable Red Hat Package Manager (RPM) package

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

    1. At a shell script, type:

          rpm -e IBMJava2-JRE     
      

      Alternatively a graphical tool such as kpackage or yast2 may be used.

    2. Remove from your PATH statement the directory where you installed the Runtime Environment .

    3. If you installed the Java Plug-in, remove the Java Plug-in files from the Netscape directory.



    Uninstalling the compressed Tape Archive (TAR) package

    To uninstall the Runtime Environment for Linux if you installed the compressed TAR package:

    1. Remove the Runtime Environment files from the directory where you installed the Runtime Environment.

    2. Remove from your PATH statement the directory where you installed the Runtime Environment.

    3. If you installed the Java Plug-in, remove the Java Plug-in files from the Netscape directory.


    Launching a Java application

    The java tool launches a Java application.

    The JVM searches for the startup class, and other classes used, in three sets of locations: the bootstrap class path, the installed extensions, and the user class path. Arguments after the class name or JAR file name are passed to the main function.

    The javaw command is identical to java, except that with javaw there is no associated console window. Use javaw when you don't want a command prompt window to appear. The javaw launcher will display a dialog box with error information if a launch fails.


    Summary of commands

    The java and javaw command have the following syntax:

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

    Items appearing within brackets are optional.

    options
    Command-line options.
    class
    Name of the class to invoke.
    file.jar
    Name of the jar file to invoke. It is used only with -jar.
    argument
    Argument passed to the main function.

    If the -jar option is specified, the named JAR file contains class and resource files for the application, with the startup class indicated by the Main-Class manifest header.


    Options

    The launcher has a set of standard options that are supported on the current runtime environment and will be supported in future releases. In addition, there is a set of non-standard options.

    Standard options

    Non-standard options

    The -X options listed below are a subset of the available ones. They are nonstandard and subject to change without notice.

    -Xargencoding

    Allows the options on the java command to use Unicode escape sequences to represent characters that are not in the character set of the locale. Unicode escape sequences are of the form \u#### where # is a hexadecimal digit.

    -Xbootclasspath:<directories and zip or jar files separated by ;>

    Sets search path for bootstrap classes and resources. There are other ways of setting the bootclasspath. See Working with the bootclasspath.

    -Xbootclasspath/a:<directories and zip or jar files separated by ;>

    Appends to end of bootstrap class path.

    -Xbootclasspath/p:<directories and zip or jar files separated by ;>

    Puts on the front of bootstrap class path.

    -Xcheck:jni

    Performs additional checks for JNI functions.

    -Xcheck:nabounds

    Performs additional checks for JNI array operations.

    -Xdebug

    Starts the JVM with the debugger enabled.

    -Xdisablejavadump

    Disables the java dump facility for abnormal process termination. When the java dump is disabled, the system process termination dump is run. The java dump is useful when the problem occurs within the java code. If the problem is in system components it might be more useful to get the normal system dump.

    -Xgcpolicy:{optthruput | optavgpause}

    Specifies the garbage collection setting. For more information, see Specifying garbage collection policy.

    -Xms<size>

    Sets initial Java heap size.

    -Xmx<size>

    Sets maximum Java heap size.

    -Xnoclassgc

    Disables class garbage collection.

    -Xoss<size>

    Sets maximum Java stack size for any thread.

    -Xquickstart

    Used for improving startup time of some Java applications. -Xquickstart causes the JIT to run with a subset of optimizations - a quick compile. This quick compile allows for improved startup time. -Xquickstart is appropriate for shorter running applications, especially those where execution time is not concentrated in a small number of methods. -Xquickstart can degrade performance if used on longer running applications containing hot methods. The implementation of -Xquickstart is subject to change in future releases.

    -Xrs

    Reduces the use of operating system signals.

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

    -Xss<size>

    Sets maximum native stack size for any thread. For more information, see Working with floating stacks.

    -Xverify

    Enables strictest checks, anticipating future default.

    |Globalization of the java command

    |The java command and other java launcher commands (such as |javaw) allow a class name to be specified as any Unicode character |that is in the character set of the current locale.

    |You can specify any Unicode character in the class name and arguments by |using java escape sequences. To do this, you must specify |-Xargencoding. To specify a Unicode character, use escape |sequences in the form \u####, where # is a hexadecimal digit (0-9, |A-F).

    |To specify that the class name and command arguments are in UTF8 or |ISO8859_1 encoding, use -Xargencoding:utf8 and |-Xargencoding:latin.

    |In the Runtime Environment, if you are using a non-English locale, the |java and javaw commands give translated output |messages. These messages are different from the ones in the |1.3.1 version and also differ based on the locale in which Java |is running. The detailed error descriptions and other debug information |returned by java is in English. Debug information that is |returned during initialization is shown in brackets.


    |Working with classpaths

    |In the Runtime Environment, you can specify a class name as a complete file |name including a full path and the .class extension. In previous |versions of the SDK, you could only specify the class relative to the |CLASSPATH, and the .class extension was not allowed. |Use of the complete file name permits you to launch a java application from |your desktop or file launcher. If you specify a .class file with |path and extension, the specified path is put into the |CLASSPATH. For example, the command java |c:\myapp\thisapp.class is equivalent to specifying |java -classpath c:\myapp thisapp.


    Working with the bootclasspath

    The system property ibm.jvm.bootclasspath can be set using the -D option described in Launching a Java application. The value of this property is used as an additional search path, inserted between any value defined by -Xbootclasspath/p: and the bootstrap classpath. The bootstrap classpath is either the default, or that defined using the -Xbootclasspath: option.


    Specifying garbage collection policy

    The -Xgcpolicy JVM runtime option specifies garbage collection policy.

    The -Xgcpolicy takes two values, optthruput (the default) and optavgpause. The option controls garbage collector behavior, making tradeoffs between throughput of the application and overall system and the pause times caused by garbage collection.

    The format of the option and its values is:

    -Xgcpolicy:optthruput

    and

    -Xgcpolicy:optavgpause

    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. As 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, 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 optavgpause value substantially reduces the time spent in these garbage collection pauses, as well as limiting the effect of increasing heap size on the length of the garbage collection pause. This is particularly relevant to configurations with large heaps. (Consider a heap as large when it is at least 1 GB.) The pause times are reduced by overlapping garbage collection activities with normal program execution. This overlapping results in a small reduction to application throughput.

    Environments with very full heaps

    If the Java heap becomes nearly full, and there is very little garbage to be reclaimed, requests for new objects might not be satisfied quickly because there is no space immediately available. If the heap is operated at near-full capacity, application performance might suffer regardless of which of the above options is used; and, if requests for more heap space continue to be made, the application receives an Out of Memory exception, which results in JVM termination if the exception is not caught and handled. In these situations, you are recommended either to increase the heap size using the -Xmx option or to reduce the number of application objects in use.

    Further information about garbage collection

    For information on heap size tuning and the implications of garbage collection for application performance, see:

    http://www.ibm.com/developerworks/library/j-jtc/index.html

    http://www.ibm.com/developerworks/library/tip-heap-size.html

    http://www.ibm.com/developerworks/library/j-leaks/index.html


    Obtaining the IBM build and version number

    To obtain the IBM build and version number, at a shell prompt type:

    java -version


    |Using the Java Plug-in

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

    |The Java Plug-in does not support printing in this release of the |SDK.


    |Installing and configuring the Java Plug-in

    |The Java Plug-in is a Web browser plug-in for use with Netscape |Communicator for Linux. If you use the Java Plug-in, you can bypass |your Web browser's default Java Virtual Machine and use instead a Java |Runtime Environment (JRE) for running applets or beans in the browser.

    |To install and configure the Java Plug-in: |

    |Installing the Java Plug-in for Mozilla

    |To make the Java Plug-in available to all users: |

    1. |Log in as user ID root
    2. |Put a symbolic link to the library file |/opt/IBMJava2-14//jre/bin/libjavaplugin_oji.so into the Mozilla plugin |directory (usually /usr/local/mozilla/plugins/, though this may vary on some |distributions).
      |ln -s /opt/IBMJava2-14/jre/bin/libjavaplugin_oji.so 
      |/usr/local/mozilla/plugins/
      |
    |Note:
    libjavaplugin_oji.so should be symbolically linked rather than copied, |as otherwise it will not be able to find the location of the JVM. |

    |Supported browsers


    |

    |Table 1. Browsers supported by the Java Plug-in

    Distribution Netscape default versions Netscape supported versions Mozilla default versions Mozilla supported versions
    Red Hat 7.3 4.79 4.79 0.9.9 0.9.9
    Red Hat Advanced Server 4.78 4.78 0.9.2 0.9.2
    SuSE 8.0

    0.9.8 0.9.8
    SuSE SLES 7 4.77 4.77

    TurboLinux 7 Server

    0.94 0.94

    |Using DBCS parameters

    |The Java Plug-in supports double-byte characters (for example Chinese |Traditional BIG-5, Korean, 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. Specify character encoding for your HTML document 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 parse the HTML file using Chinese BIG-5 |character encoding. All the parameters are passed to the Java Plug-in |correctly. However, some of the 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.

    |You can specify which encoding you want to use to parse the HTML |file: |


    |Using Web Start

    |Java Web Start is a means of deploying Java technology-based |applications. It connects the computer and the Internet and allows the |user to launch and manage applications directly from the Web. Java Web |Start provides one-click activation of applications, and ensures that you are |always running the latest version, eliminating installation or upgrade |procedures. Often, distributing software across the Web requires you to |find the installer on the Web, download the installer, locate the installer, |and execute the installer. After the installer is executed, it prompts |for installation directories and installation options such as full, typical, |or minimum. This can be a time-consuming and complicated task that must |be repeated for each new version of the software.

    |In contrast, Web-deployed applications, such as your HTML-based e-mail |client and calendar, are straightforward to install and use. The Web |browser has automated the process. There are no complicated download, |setup, and configuration steps, and you are guaranteed to be running the |latest version. Java Web Start provides the same benefits to |full-featured applications.

    |For information on the browsers that support Web Start go here.

    |For more information about Web Start, see: http://java.sun.com/products/javawebstart |and for more documentation, see: http://java.sun.com/j2se/1.4.1/docs/guide/jws/index.html.


    |Installing Web Start

    |The Web Start installation script is installed along with the JRE for Java |1.4.0.

    |The script is called jre/bin/webstart_install.sh. Each user |wishing to use Web Start must run the script. Set the current working |directory to the location in which the user wants to install Web Start. |The installation process creates a subdirectory called javaws in |the current working directory.

    |The installation process also updates the mime-types used by Netscape and |other browsers.

    |There are two ways to invoke Web Start: |

    1. |Select a link on a Web page that is a reference to a .jnlp |file.
    2. |Start javaws from the javaws directory created |above, thus starting the Web Start dialog from which applications can be |selected.
    3. |At a shell script, type javaws <URL>, where |<URL> is the location of a .jnlp file. |

    |Either of these actions causes Web Start to start the selected |application. The application is downloaded if this is the first time it |is being used. On subsequent invocations, the original Web site is |checked to see if any updates are available. Web Start will download |these updates before the application is started.


    Working with floating stacks

    Certain Linux distributions - Red Hat, for example - have enabled a GLIBC feature called 'floating stacks'. Because of Linux kernel limitations, the JVM will 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 256KB for each thread is provided. On a floating stack Linux system, the -Xss values are honored. Thus, 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 256KB.


    |Switching the input method in DBCS languages

    |On double-byte character set (DBCS) systems, if you want to switch the |input method, you should use java.util.prefs.Preferences |class instead of IBMJAVA_INPUTMETHOD_SWITCHKEY and |IBMJAVA_INPUTMETHOD_SWITCHKEY_MODIFIERS environment |variables. See Sun's Input Method Framework |Specification in detail.


    Runtime example

    The Sun Web site, http://java.sun.com, contains a "Hello World" example that you can download. The example demonstrates how to create a simple Java application that runs on the Runtime Environment.


    Installing your application on a user's system

    After you develop your product and are ready to ship, you need to install your product on a user's system, configure the user's system to support your software, and configure the runtime environment.

    If you use the Runtime Environment for Linux, you must make sure that your installation procedure does not overwrite an existing installation (unless the existing Runtime Environment for Linux is an older version).

    To redistribute the Runtime Environment for Linux, you can install it on your own system, then copy the required Runtime Environment files into your installation set. If you choose this approach, you must include all the files provided with the Runtime Environment for Linux. The Runtime Environment for Linux software can only be redistributed if all files are included. In effect, when you ship your application, it has its own copy of the Runtime Environment for Linux.

    For specific information about the files that must be redistributed, see the license agreement that accompanies this product.


    Known limitations

    The following sections explain known limitations of the SDK for Linux.

    |The following limitations apply to users of Traditional Chinese |only.


    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 in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to:

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

    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 information. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this information 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:

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


    Trademarks

    IBM is a trademark of International Business Machines Corporation in the United States, or other countries, or both.

    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. The Java technology is owned and exclusively licensed by Sun Microsystems, Inc.

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

    This product includes software developed by the Apache Software Foundation http://www.apache.org/.