Skip navigation.
Downloads | Product Documentation | Support

Using JRockit JDK

# Starting and Configuring BEA JRockit JVM

This section describes how to start BEA JRockit and how to configure it by using standard and non-standard command line options. It includes information on the following subjects:

- Before Starting BEA JRockit
- Starting BEA JRockit
- Configuring BEA JRockit

# Before Starting BEA JRockit

Before starting BEA JRockit, ensure that you have the following directory set in your PATH environment variable:

- `<jrockit-install-directory>/bin` (for Linux)
- `<jrockit-install-directory>\bin` (for Windows)

# Starting BEA JRockit

To start BEA JRockit, at the command line enter the following:

>     java <configuration and tuning options> myClass

Where `<`configuration and tuning options`>` are the optional configuration and tuning options you want to use. The configuration options are described in Configuring BEA JRockit, below. See Tuning BEA JRockit JVM for details on the tuning options available for this version of BEA JRockit.

Note: You can alternatively start JRockit by specifying the full path to the file; for example, /`usr/local/java/bin/java` (depending on where it is installed) on Linux and `c:\bea\jrockit` `xxx``\bin\java` (depending on where it is installed) on Windows.

## Setting the JRockit Type

The following commands set the type of JRockit you want to run, server-side or client-side:

- `-server`

Starts BEA JRockit as a server-side JVM. This option is default.

- `-client`

Starts BEA JRockit as a client-side JVM. This option is helpful if you have a smaller heap and are anticipating shorter runtimes for your application.

By setting the JVM type (or accepting the default) will also set the garbage collection algorithm that will be used during runtime. `-server` will start the dynamic garbage collector optimized for throughput while `-client` will start a a single-spaced, concurrent mark, concurrent sweep garbage collector. If you want to use a specific fixed garbage collector, you can override the default by using the `-Xgc` command line option.

## Sample Start-up Command

A sample start-up command, with some tuning options specified, might look like this:

>     java -Xverbose:memory -Xmx:256m -Xms:64m myClass

In this example, the following options are set:

- `-Xverbose:memory`—Displays verbose output about memory usage.
- `-Xmx:256m`—The maximum heap size is set to 256 megabytes.
- `-Xms:64m`—The initial and minimum heap size is set to 64 megabytes.
- `myClass`—Identifies the class that contains the `main` method.

# Configuring BEA JRockit

When you start BEA JRockit, you can set behavioral parameters by using both standard and non-standard command line options. This section describes some of these options and how to use them at startup to configure BEA JRockit. It contains information on the following subjects:

- Using Standard Command Line Options for:

- Setting General Command Line Options
- Providing Information to the User

- Using Extended Options for:

- Setting Behavioral Options
- Providing Information to the User
- Including a Timestamp with Logging Information

## Using Standard Command Line Options

The standard command line options work the same regardless of the JVM; in other words, these options work the same whether you are running BEA JRockit, Sun Microsystem's HotSpot JVM, or any other third party JVM.

### Setting General Command Line Options

The following standard command line options set general information about BEA JRockit:

- `-classpath <directories and zips/jars separated by : (Linux) or ; (Windows)>`

Specifies the location of classes and resources.

Alternately, you can use the option `-cp` to represent `-classpath`; for example:

`-cp <directories and zips/jars separated by : or ;>`

- `-D<name>[=<value>]`

Specifies a Java system property. These can be read by a Java program, using the methods in `java.lang.System`.

### Providing Information to the User

The following options determine if the system will provide messages to the operator and what the form and content of those messages should be.

- `-help`

Displays a short help message.

- `-version`

Displays the product version of JRockit and then exits.

- `-showversion`

Displays the product version of JRockit and then continues with the operation.

- `-verbose`

Displays verbose output. This option is used mainly for debugging purposes and causes a lot of output to the console.

## Using Extended Options

Extended command line options, proceeded with the letter `-X`, are options that are exclusive to BEA JRockit and changes the behavior of JRockit to better suit the needs of different Java applications. These options will not work on other JVMs (conversely, the extended options used by other JVMs won't work with JRockit).

The option `-X` displays a short help message on the extended options.

Note: Since these options are an extension to JRockit and non-standard, they are subject to change between releases, see the BEA JRockit JDK Compatibility Statement.

### Setting Behavioral Options

The following are examples on extended options that define general BEA JRockit JVM behavior:

- `-Xns`

Sets the size of the nursery in a generational garbage collector.

- `-Xms`

Sets the initial size of the heap.

- `-Xgc`

Sets a specific fixed garbage collector.

- `-Xgcprio`

Sets the dynamic garbage collector.

### Providing Information to the User

When using the startup option `-Xverbose`, BEA JRockit prints, on screen, specific information about the system. The information printed depends upon the parameter that you have specified with the option. Supported parameters are, for example, `memory`, `load`, `gc`, `opt`, and `cpuinfo`. If you do not specify any parameter, everything will be printed.

Note: To use more than one parameter, separate them with a comma, for example:
`-Xverbose:gc,opt`

Listing 2-1 through Listing 2-6 combined with Table 2-1 through Table 2-6 lists and explains examples of different verbose output. These output examples are to hint you to how the verbose output can look like. The output that you see in these listings can greatly differ from what you see on your system depending on, for example, the version of BEA JRockit that you are running.

Listing 2-1 Print out for -Xverbose:codegen

>     [codegen] #1 ? (0x2) n jrockit/vm/Allocator.prepareNextChunkAndAlloc(IIII)Ljava/lang/Object;

>     [codegen] #1 ? (0x2) n @0x6b3543f0-0x6b354465  1.43 ms (1.43 ms)

Table 2-1 Explanation of Listing 2-1

Code snippet | Explanation
--- | ---
`[codegen] #1 ? (0x2) n` | This is the first (#1) method to be generated with a normal (`n`) or non-optimized code generation. `n` means non-optimized code generation `o` means optimized code generation `q` means quick code generation
`jrockit/vm/Allocator.prepareNextChunkAndAlloc(IIII)Ljava/lang/Object;` | This is the name and location of the method that has been generated.
`@0x6b3543f0-0x6b354465` | The address in the memory where the method resides.
`1.43 ms` | The time it took to generate the code.
`(1.43 ms)` | The total time that JRockit has generated code.

Listing 2-2 Print out for -Xverbose:opt

>     [opt    ] #1 4 (0x8) o jrockit/vm/Locks.waitForThinRelease(Ljava/lang/Object;I)I

>     [opt    ] #1 4 (0x8) o @0x324D0000-0x324D00A1  26.80 ms (26.80 ms)

Table 2-2 Explanation of Listing 2-2

Code snippet | Explanation
--- | ---
`[opt ] #1 4 (0x8) o` | This is the first (`#1`) method to be generated with an optimized (`o`) code generator. `n` means non-optimized code generation `o` means optimized code generation `q` means quick code generation
`jrockit/vm/Locks.waitForThinRelease(Ljava/lang/Object;I)I` | This is the name and location of the method that has been generated.
`@0x324D0000-0x324D00A1` | The address in the memory where the method resides.
`26.80 ms` | The time it took to generate the code.
`(26.80 ms)` | The total time that JRockit has generated code.

Listing 2-3 Print out for -Xverbose:cpuinfo

>     [cpuinfo] Vendor:   GenuineIntel

>     [cpuinfo] Type:     Original OEM

>     [cpuinfo] Family:   Pentium 4

>     [cpuinfo] Brand:    Intel(R) Xeon(TM) CPU 2.80GHz

>     [cpuinfo] Supports: On-Chip FPU

>     [cpuinfo] Supports: Virtual Mode Extensions

>     [cpuinfo] Supports: Debugging Extensions

Table 2-3 Explanation of Listing 2-3

Code snippet | Explanation
--- | ---
`[cpuinfo] Vendor: GenuineIntel [cpuinfo] Type: Original OEM [cpuinfo] Family: Pentium 4 [cpuinfo] Brand: Intel(R) Xeon(TM) CPU 2.80GHz` | This is information about the CPU chip itself, i.e. vendor, type of chip, family name, and the brand name. This information differs depending on the type of CPU you are using.
`[cpuinfo] Supports: On-Chip FPU [cpuinfo] Supports: Virtual Mode Extensions [cpuinfo] Supports: Debugging Extensions . . .` | This lists all features that the CPU supports. For more information about your specific CPU, please contact the vendor.

Listing 2-4 Print out for -Xverbose:load

`[load ] opened zip /localhome/jrockits/jrockit-jdk1.5.0_02/jre/lib/jrockit.jar`

`[load ] opened zip /localhome/jrockits/jrockit-jdk1.5.0_02/jre/lib/rt.jar
[load ] opened zip /localhome/jrockits/jrockit-jdk1.5.0_02/jre/lib/jsse.jar`

`[load ] opened zip /localhome/jrockits/jrockit-jdk1.5.0_02/jre/lib/jce.jar`

`[load ] opened zip /localhome/jrockits/jrockit-jdk1.5.0_02/jre/lib/charsets.jar`

`[load ] opened zip /localhome/jrockits/jrockit-jdk1.5.0_02/jre/lib/managementapi.jar`

`[load ] initiated ? (0x2) 0 (nil)/java/lang/Object`

`[load ] define ? (0x2) # 0 java/lang/Object loader=(nil), src=/localhome/jrockits/jrockit-jdk1.5.0_02/jre/lib/jrockit.jar`

`[load ] loading ? (0x2) 0 (nil)/java/lang/Object success (0.59 ms)`

Table 2-4 Explanation of Listing 2-4

Code snippet | Explanation
--- | ---
`[load ] opened zip /localhome/jrockits/jrockit-jdk1.5.0_02/jre/lib/jrockit.jar` | This is information about the classes loaded in JRockit.
`java/lang/Object` | The name of the class loaded for your application.
`src=/localhome/jrockits/jrockit-jdk1.5.0_02/jre/lib/jrockit.jar` | The address from where the class is loaded.
`success` | Shows if the class loaded successfully. If it failed, the print out is `fail`.

Listing 2-5 Print out for -Xverbose:memory (dynamic garbage collector)

>     [memory ] GC strategy: System optimized over throughput (initial strategy singleparpar)

>     [memory ] heap size: 65536K, nursery size: 16384K

>     [memory ] <s>-<end>: GC <before>K-><after>K (<heap>K), <pause> ms

>     [memory ] <s/start> - start time of collection (seconds since jvm start)

>     [memory ] <end>     - end time of collection (seconds since jvm start)

>     [memory ] <before>  - memory used by objects before collection (KB)

>     [memory ] <after>   - memory used by objects after collection (KB)

>     [memory ] <heap>    - size of heap after collection (KB)

>     [memory ] <pause>   - total pause time during collection (milliseconds)

>     [memory ] Changing GC strategy to generational, parallel mark and parallel sweep

>     [memory ] 1.719-1.731: GC 65536K->3176K (65536K), 11.000 ms

Table 2-5 Explanation of Listing 2-5

Code snippet | Explanation
--- | ---
`[memory ] GC strategy: System optimized over throughput (initial strategy singleparpar)` | Information about the garbage collector strategy that is used. This is the default dynamic garbage collector that optimizes over throughput.
`[memory ] heap size: 65536K, nursery size: 16384K` | This is the initial heap and nursery size.
`[memory ] <s>-<end>: GC <before>K-><after>K (<heap>K), <pause> ms` | This is the format of the verbose print. The text that follow is an explanation of the different parts of the print-out.
`[memory ] 1.719-1.731: GC 65536K->3176K (65536K), 11.000 ms` | This the first verbose print of a successful garbage collection.

Listing 2-6 Print out for -Xverbose:memory (parallel, single-spaced garbage collector)

>     [memory ] GC strategy: parallel

>     [memory ] heap size: 65536K

>     [memory ] <s>-<end>: GC <before>K-><after>K (<heap>K), <pause> ms

>     [memory ] <s/start> - start time of collection (seconds since jvm start)

>     [memory ] <end>     - end time of collection (seconds since jvm start)

>     [memory ] <before>  - memory used by objects before collection (KB)

>     [memory ] <after>   - memory used by objects after collection (KB)

>     [memory ] <heap>    - size of heap after collection (KB)

>     [memory ] <pause>   - total pause time during collection (milliseconds)

>     [memory ] 1.561-1.572: GC 65536K->1420K (65536K), 10.000 ms

Table 2-6 Explanation of Listing 2-6

Code snippet | Explanation
--- | ---
`[memory ] GC strategy: parallel` | Information about the garbage collector strategy that is used. Here it is a static parallel, single-spaced garbage collector.
`[memory ] heap size: 65536K` | This is the initial heap size.
`[memory ] <s>-<end>: GC <before>K-><after>K (<heap>K), <pause> ms` | This is the format of the verbose print. The text that follow is an explanation of the different parts of the print-out.
`[memory ] 1.561-1.572: GC 65536K->1420K (65536K), 10.000 ms` | This the first verbose print of a successful garbage collection.

### Including a Timestamp with Logging Information

Use the startup options `-Xverbose:memory` and `-Xverbosetimestamp` or `-Xverbose:opt` and `-Xverbosetimestamp` to view a time and date stamp preceded by the other verbose information, as shown here:

>     [Thu Apr 21 10:24:11 2005][ 5656][memory ] 4.578: parallel nursery GC 22067K->7457K (65536K), 8.905 ms

>     [Thu Apr 21 10:24:11 2005][ 5656][memory ] 4.781: parallel nursery GC 22157K->7549K (65536K), 9.954 ms

Sample of timestamp information for`-Xverbose:opt` and `-Xverbosetimestamp`:

>     [Thu Apr 21 10:24:19 2005][ 5576][opt    ] #3 4 (0x8) o jrockit/vm/Locks.monitor Enter(Ljava/lang/Object;)Ljava/lang/Object;

>     [Thu Apr 21 10:24:19 2005][ 5576][opt    ] #3 4 (0x8) o @0x324D0A90-0x324D0AD4 3.29 ms (235.46 ms) 17.26 ms (252.72 ms)