4 Integration with the Eclipse IDE

This chapter describes the integration of Oracle JRockit Mission Control with Eclipse IDE and provides instructions for using the special functionality enabled by integrating the JRockit Mission Control Client with Eclipse.

In addition to the standalone Rich Client Platform (RCP) version of Oracle JRockit Mission Control 4.0, the toolset is also available as a plug-in to the Eclipse IDE (Eclipse 3.3 or above). This version of JRockit Mission Control provides seamless integration of JRockit Mission Control's application profiling and monitoring toolset with the Eclipse development platform. By integrating the JRockit Mission Control Client with Eclipse, you can combine the features of Eclipse with the power toolset in Mission Control.

The chapter contains the following topics:

4.1 Benefits of the Integration

When the JRockit Mission Control Client is run within the Eclipse IDE, you have access to IDE features that aren't otherwise available in the toolset when it is run as a standalone Rich Client Platform (RCP) application. The most significant of these features is the ability to see specific code in the running application by opening it directly from the JRockit Mission Control Client, a function called Jump-to-Source.

The other obvious benefit of integrating the JRockit Mission Control Client with the Eclipse IDE is that it allows you to profile and monitor an application during their development phase just as you would during their production phase. This allows you to spot potential runtime problems before you actually deploy your application to production; for example, you might, while monitoring an application during its development notice a memory leak. By catching the memory leak during development, you can correct it before you migrate your application to a production environment.

4.2 Differences between the Eclipse Version and the RCP Version

Generally, the Eclipse version of the JRockit Mission Control Client works identically to the RCP version. Any component in the Eclipse version offers the same functionality and user interface as the comparable component delivered on the RCP.

The biggest difference that Eclipse version of the JRockit Mission Control Client has over the RCP version is the Jump-to-Source feature, described in Section 4.5, "Jumping to Application Source". With this feature, you can not only see the name of a "problem" class or method displayed in the JRockit Mission Control Client, but you can jump from the displayed name directly to that class or method's source, where you can evaluate the code to see what might be causing the problem. Jump-to-Source is enabled for the Management Console, the JRockit Flight Recorder, and the Memory Leak Detector.

4.3 Making the JRockit JVM Your JVM

While JRockit Mission Control can work with many different Java Virtual Machines, it is highly recommended that you use the Oracle JRockit JVM as your JVM when running Mission Control on the Eclipse platform. Not only will you avail yourself of the JRockit JVM's exceptional performance, but by using this JVM, Mission Control's autodetect feature will be enabled, which makes it simple to connect Mission Control to your locally running application.

To run Eclipse (and thus the JRockit Mission Control Client) on the JRockit JVM

  1. Go to your file system browser (for example, Windows Explorer).

  2. Locate your Eclipse installation folder (for example, C:\Program Files\Eclipse) and, with a file editor other than Notepad, open the file eclipse.ini. It will look something like the example in Example 4-1.

    Example 4-1 eclipse.ini Example

    -showsplash
    org.eclipse.platform
    --launcher.XXMaxPermSize 
    256M
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xms40m
    -Xmx512m 
    
  3. Make the following changes to eclipse.ini:

    • Remove all flags related to non-Oracle JRockit JVMs (for example, --launcher.XXMaxPermSize 256M)

    • On the third line down (after org.eclipse.platform), add the following:

      -vm
      <Full path to JRockit JVM's javaw file>
      

      The full path to JRockit's javaw file might look like this on Windows:

      C:\Program Files\Java\jrockit-R27.4.0-jdk1.6.0_02\bin\javaw.exe
      

      or like this on Linux and Solaris:

      $HOME/jrockit-R27.4.0-jdk1.6.0_02/bin/java
      
    • Depending upon your particular JRockit JVM implementation and the applications running on it, you can set any valid JRockit JVM command-line option. For example, you might want to set a garbage collector that meets your system priorities by using the -XgcPrio: option or increase (or decrease) the initial and maximum heap size by changing the values for -Xms and -Xmx.

      For more information on tuning the JVM, please refer to "Profiling and Performance Tuning" in the Oracle JRockit JVM Diagnostics Guide on the Oracle Technology Network

      For more information on the available command-line options, please refer to the Oracle JRockit JVM Command-Line Reference.

  4. When you are done making the necessary changes to eclipse.ini, save and close the file. Example 4-2 shows an example of the eclipse.ini file updated to make Oracle JRockit JVM the JVM.

Example 4-2 Updated eclipse.ini file for a Windows implementation

-showsplash
org.eclipse.platform
-vm
C:\Program Files\Java\jrockit-R27.4.0-jdk1.6.0_02\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms256m
-Xmx512m 
-XgcPrio:pausetime

4.4 Selecting a Perspective

A "perspective" defines a set of views and their relative positions within the Eclipse window; in other words, it is a template for graphically presenting different types of information in Eclipse. For example, the Java perspective combines views that you would commonly use while editing Java source files, while the Debug perspective contains the views that you would use while debugging Java programs.

JRockit Mission Control plug-ins for Eclipse come with a predefined perspective called JRockit Mission Control. This perspective shows the JRockit Mission Control Client interface so that you can use the tools in JRockit Mission Control to profile applications as you develop them in Eclipse.

This topic will show you how:

To open the Mission Control Perspective

  1. In top right corner of the Eclipse window, click the Open Perspective icon (Figure 4-1).

    Figure 4-1 Open Perspective Icon

    Description of Figure 4-1 follows
    Description of "Figure 4-1 Open Perspective Icon"

    The Open Perspective context menu appears (Figure 4-2).

    Figure 4-2 Open Perspective Context Menu

    Description of Figure 4-2 follows
    Description of "Figure 4-2 Open Perspective Context Menu"

  2. Select Other.

    The Open Perspective dialog box appears (Figure 4-3).

    Figure 4-3 Open Perspective Dialog Box

    Description of Figure 4-3 follows
    Description of "Figure 4-3 Open Perspective Dialog Box "

  3. Select Mission Control and click OK.

    The Eclipse window reconfigures to show the Mission Control Standard Perspective.

To change perspective from Mission Control

You can change perspectives from Mission Control to another perspective by using one of the methods described in Table 3–1:

Table 4-1 Changing Perspectives

If... Do this...

You've never opened the perspective

  1. Click the Open Perspective icon.

  2. Either:

Select the perspective you want to open.

If the perspective name does not appear on the context menu, select Other to open the Open Perspective dialog box and select the perspective from there.

You've opened the perspective before

If you've opened the perspective before, a button for that perspective will appear in the top right corner of the Standard Mission Control Perspective, near the Open Perspective icon. Simply click the button for the perspective you want to open.


To reopen the Mission Control Standard Perspective

If you have already opened the Mission Control Standard Perspective for this project, a Mission Control button will appear next to the Open Perspective button in the top right corner of the Eclipse window (Figure 4-4).

Figure 4-4 Open Standard Mission Control Perspective Button

Description of Figure 4-4 follows
Description of "Figure 4-4 Open Standard Mission Control Perspective Button"

To reopen the perspective, simply click that button.

4.5 Jumping to Application Source

When running JRockit Mission Control plug-ins in an Eclipse IDE you can select a method or class and jump from the JRockit Mission Control Client directly to the source code where that method or class is declared. An editor will open up showing you the source file. Jump-to-Source is available on the Management Console and the Memory Leak Detector:

This topic contains the following information:

4.5.1 Using Jump-to-Source

To jump from the JRockit Mission Control Client to source code

Note:

The following procedure is generic. See Section 4.5.2, "JRockit Mission Control Plug-ins with Jump-to-Source Enabled" for a list of plug-ins where this feature is enabled.

  1. On the table, tree or other GUI component listing classes or methods, right-click the class or method for which you want to see the source code.

    A context menu appears.

  2. Select Open Method (or Open Type, if you are jumping from to a class call).

    The associated source code will appear in a new editor.

4.5.2 JRockit Mission Control Plug-ins with Jump-to-Source Enabled

Note:

This feature only works with versions of the JRockit Mission Control Client integrated into the Eclipse IDE.

Table 3–2 lists the Oracle JRockit Mission Control plug-ins where Jump-to-Source is enabled.

Table 4-2 Plug-ins with Jump-to-Source Enabled

Plug-in Component

Management Console

Jump-to-source is enabled on:

  • Threads tab

  • Stack traces for selected threads

  • Exception Counter

  • Profiling Information table

Memory Leak Detector

Jump-to-source is enabled on:

  • Trend Table

  • Application Stack Traces