Apache Harmony is retired at the Apache Software Foundation since Nov 16, 2011.

The information on these pages may be out of date, or may refer to resources that have moved or have been made read-only.
For more information please refer to the Apache Attic

Getting Started with DRLVM

Getting Started with DRLVM

  1. About This Document
  2. Overview
  3. Running an Application
  4. Developing Code in Eclipse
    1. Running an Application in Eclipse
    2. Debugging an Application in Eclipse

About This Document

The Dynamic Runtime Layer virtual machine (DRLVM) is a clean-room implementation of the Java* virtual machine for Java 2 Platform, Standard Edition (J2SE*) 1.5.0. This document gives tips on how to start using the DRL virtual machine (VM). Use this page to learn where to get the code and how to use it. For documentation on the Harmony Java* class libraries, see the classlib page.

To quickly start with DRL, read this page and follow the instructions. It is recommended that you strictly follow the instructions of this guide to ensure system stability and anticipated results. After completing this guide, you will be able to run and debug your own applications with DRLVM.

Overview

For a definition of the DRL virtual machine and links to all docs describing it, see the DRLVM component page. For instructions on how to get and build the code, and configure your environment, please visit the Getting Started for Users page. If you fail to build the source code or come across other problems, go to our project Wiki resource and search for your issue on the DrlvmBuildTroubleshooting page. If no known issue matches your problem, please write to the mailing list or add your issue to the wiki page.

The README file supplied with the source code and the Quick Help instructions enable you to build the VM source code in the default configuration. To modify the code behavior, use the available command-line options, as indicated in the Wiki command-line options page. Read further for illustrations of command-line options usage.

Running an Application

This scenario provides step-by-step instructions on running a Hello application in the Windows* or the Linux* console. The scenario uses a sample Hello.class Java* class for illustration. Please use your own application instead.

  1. To start DRL, change your current directory to the <installation folder>\bin directory.
  2. Check that you have files java.exe on Windows* or java on Linux* and Hello.class in the \bin directory.
    On Linux*, make sure that you can run applications and load dynamic libraries from the current directory. If you are using the Intel(R) C++ compiler, make sure the LD_LIBRARY_PATH variable contains location of the ICC libraries.
  3. Run the Hello application by entering:
    java Hello
    

    You will see “Hello World!" printed on the screen. This means that you have successfully launched the virtual machine, and that it has processed the Hello.class Java* class to execute the Hello application.

Developing Code in Eclipse

Running an Application in Eclipse

In this section, a simple scenario shows how to create an application and run it in Eclipse* with our virtual machine.

Note

If you are using Eclipse, see the page Working with Harmony Code in Eclipse for specific setup instructions.

This scenario provides step-by-step instructions on running a Java application in the Eclipse environment. In the scenario, you will launch Eclipse, create a new project and a new Java class within this project, and finally you will run the new application.

  1. If you have no Eclipse, download the package at http://download.eclipse.org/eclipse/downloads/, and unpack this distribution.
    Set up Eclipse as described in Working with Harmony Code in Eclipse.
  2. Start Eclipse and create a new Java project.
  3. In the project workspace, create a HelloWorld class with the public static void main(String[] args) method containing the following code:
    int i=18; 
    System.out.println("Hello, World!");
  4. Save the file.
  5. Run the HelloWorld class. The result of the execution is printed in the Console tab of your workspace: "Hello, World!" appears.

Debugging an Application in Eclipse

This scenario provides instructions on how to debug a simple application in Eclipse*.

  1. Repeat steps 0 to 4 of the previous scenario to set up the workspace and create a new class in the new project.
  2. Set up breakpoints for debugging purposes, as needed. In the example with the HelloWorld class, set the breakpoint on the following line:
    System.out.println ("Hello, World!");
    
  3. Start the debug operation on your class - HelloWorld.java in the example.

    After the debug run completes, the workspace gets updated with new results.
  4. After you are done, resume the application. When the run has completed, the Console tab at the bottom displays the result of execution. In our example, Hello World! is printed.

* Other brands and names are the property of their respective owners.