Apogee JREs are based on a highly configurable J9VM technology and provide a multitude of options to control their behavior. Here, we present often used options, together with a short summary of their functionality, in order to get you started quickly with using Apogee JREs.

Installation.

Apogee JREs are usually distributed as a single compressed archive (.tgz/.zip) which must be extracted and copied to the target system prior to running Java applications.  A JRE is composed of 2 main directories: 
  • bin - contains native binaries that implement JRE functionality.
    • include - contains header files used to compile application JNI code
  • lib - contains Java class libraries, additional packages, configuration files, etc.
    • jclFoundation10 - contains Java class library for Foundation Profile 1.0 (MJRE)
    • jclFoundation11 - contains Java class library for Foundation Profile 1.1.2 (MJRE)
    • jclHarmony - contains Harmony Java class library (CJRE)

Running.

Running of Apogee JREs is accomplished by invoking j9 executable with appropriate options.  Selection of the profile (MJRE/CJRE) is done at startup via -jcl: option, which attempts to load and initialize specific shared library that implements native features of such profile. E.g.
  • bin/j9 -jcl:foun10 - uses libjclfoun10_2?.so for Foundation Profile 1.0 (MJRE)
  • bin/j9 -jcl:foun11 - uses libjclfoun11_2?.so for  Foundation Profile 1.1.2 (MJRE)
  • bin/j9 -jcl:harmony - uses libjclharmony_2?.so for Harmony (CJRE)
Apogee JREs also support most of the options present in other JREs.  These include:
  • -classpath - class search path of directories and zip/jar files
  • -D<name>=<value> - set a system property
  • -verbose - enable verbose output
  • -Xint - interpreted mode execution only
  • -Xbootclasspath: - set search path for bootstrap classes and resources
  • -Xmx<size> - set maximum Java heap size
  • -Xss<size> - set java thread stack size
Information on the additional options can be obtained by passing -help or -X to j9 executable.

Controlling Memory Usage.

Apogee JREs uses system memory for many purposes, most of which could be reduced and/or limited to maximize memory available for the rest of the system:
  • mapped .text/.data/.bss sections from native (shared) libraries comprising JRE
    • can be reduced by preventing the loading of unnecessary components, such as bytecode verifier (j9bcv), debug (j9dbg) or profiling support (j9prf).
  • native and java stacks used by each thread in Java application
    • native stack size can be limited via -Xmso option
    • java stack size can be limited via -Xss option
  • storage of data for loaded .class files
    • can be reduced by modifying application logic
  • storage of compiled JIT code
    • can be limited via -Xjit:codetotal option
  • heap for java objects
    • can be limited via -Xmx option

Debugging.

Apogee JREs provide support for debugging via JDWP, which means that your Java applications can be debugged using most of the Java IDEs (including Eclipse and NetBeans).  JRE must be started in a debug mode, controlled via -Xrunjdwp: argument:
  • bin/j9 -Xdebug -Xrunjdwp:server=y,suspend=[n|y],address=8888 ...
    • server=y - wait for a connection from remote debugger (e.g. Eclipse)
    • suspend=y - suspend application until debugger connects
    • address=8888 - use port 8888 for debugger connection
Newer versions also include JVMTI support, extending debugging and profiling functionality.  

Using JIT Compiler.

Apogee JREs support JIT compilation using -Xjit argument. More detailed list of JIT-related options can be found here, but there are a few factors that must be taken into an account when using JIT:
  • compilation itself does takes time, which may impact application timing
  • JIT uses heap memory to store compiled data, which is not accounted for in using -Xmx.
    • heap usage can be limited via -Xjit:codetotal=NNN option
  • fully interpreted mode (no JIT) can be enforced using -Xint option