# Apache Harmony

</td></tr>
Developer(s) Apache Software Foundation 5.0M156.0M3 / September 15, 2010; 12 years ago {{#property:P1324}} Retired[1] C++, Java Windows, Linux Java Virtual Machine, Java Library Apache License 2.0 harmony.apache.org

Apache Harmony is a modular Java runtime with class libraries and associated tools.

It supports wide range of different platforms. The main criteria for whether a particular platform is supported or not is the involvement of people in running tests on regular basis, reporting build status, finding and fixing bugs for that platform.

It was announced in early May 2005 and on October 25, 2006, the Board of Directors voted to make Apache Harmony a top-level project. The Harmony project achieved (as of February 2011) 99% completeness for J2SE 5.0 and 97% for Java SE 6.

On October 29, 2011 a vote was started by the project lead Tim Ellison whether to retire the project. The outcome was 20 to 2 in favor.

## History

### Initiation

The Harmony project was initially conceived as an effort to unite all developers of the free Java implementations. Many software developer expected that it would be the project above the GNU, Apache and other communities. GNU developers were invited into and participated during the initial, preparatory planning.

### Incompatibility with GNU Classpath

Despite the impression given by the preparatory planning, it was decided not to use the code from GNU Classpath, and that Harmony would use an incompatible license; therefore blocking the collaboration between Harmony and existing free Java projects.[2] Apache developers would then write the needed classes from scratch and expect necessary large code donations from software companies. Various misunderstandings at the start of the project, and the fact that major companies like IBM proposed to give large amount of existing code, created some confusion in the free Java community about the real objectives of the project.

One major point of incompatibility between the GNU Classpath and Apache Harmony projects was their incompatible licenses: Classpath's GNU General Public License with the linking exception versus Harmony's Apache License.

### Use in Android SDK

Dalvik, the virtual machine that was used in Google's Android platform up to version 4.4 (and Android Runtime (ART), that followed), uses a subset of Harmony for the core of its Class Library.

However, Dalvik does not align to Java SE nor Java ME |Class Library profiles (for example J2ME classes, AWT and Swing are not supported).

In December 2015, Google announced that the next version of Android would use OpenJDK libraries instead.[3]

### Disengagement from IBM

On October 11, 2010, IBM, by far the biggest participant in the project, decided to join Oracle on the OpenJDK project, effectively shifting its efforts from Harmony to the Oracle reference implementation. Bob Sutor, IBM's head of Linux and open source, blogged that "IBM will be shifting its development effort from the Apache Project Harmony to OpenJDK".

On March 2011, IBM's Tim Ellison announced that he resigned as Project Management Chair for Harmony, a move which brought questions about the future of the project.

### End of the project

On October 29, 2011, a poll was started on the harmony-dev mailing list by the project lead Tim Ellison whether to retire the project. The outcome on November 3, was 20 to 2 in favor of retirement.On November 16, 2011, the Apache Software Foundation board of directors passed a motion to terminate the project. One director, Larry Rosen, cast a "no" vote, based on the timing rather than the merits of the proposal; it was otherwise unanimous. The project was retired on November 16, 2011.

## Development team

At the start, Apache Harmony received some large code contributions from several companies. Development discussions have taken place on open mailing lists. Later, the Apache Software foundation mentors put a lot of effort into bringing the development process more in line with "the Apache way," and it seemed that their efforts were successful.

## Last development status

Apache Harmony was accepted among the official Apache projects on October 29, 2006.

### Architecture

The Dynamic Runtime Layer virtual machine consists of the following components:

1. The VM core: with its subcomponents concentrates most of the JVM control functions.
2. The porting layer: hides platform-specific details from other VM components behind a single interface and is based on the Apache Portable Runtime layer.
3. The garbage collector: allocates Java objects in the heap memory and reclaims unreachable objects using various algorithms
4. Execution Manager: selects the execution engine for compiling a method, handles profiles and the dynamic recompilation logic.
5. Class Library: is a Java standard library.
7. The execution engine: consists of the following:
1. The just-in-time compiler for compilation and execution of method code.
2. The interpreter for easier debugging.

### Support platform and operating system

The project provided a portable implementation that ease development on many platforms and operating systems. The main focus was on Windows and Linux operating systems on x86 and x86-64 architectures.

Windows 2000 Windows XP, Server 2003, Vista Gentoo, Fedora FreeBSD AIX Mac OS X
IA-32 (Pentium III or better) No Yes Yes No n/a n/a
x86-64 (Intel 64, AMD64) n/a Yes Yes n/a n/a n/a
Itanium (IA64, IPF) n/a No Yes n/a n/a n/a
PowerPC 32-bit n/a n/a n/a n/a n/a n/a
PowerPC 64-bit n/a n/a No n/a No n/a
zSeries 31-bit n/a n/a No n/a n/a n/a

### Class library coverage

The expected donations from software companies were actually received. The Apache Harmony now contains the working code, including the Swing, AWT and Java 2D code which were contributed by Intel.

The Harmony project currently achieve (as of February 2011) 99% completeness for JDK 5.0, and 97% for Java SE 6.

The progress of the Apache Harmony project can be tracked against J2SE 1.4 and Java SE 5.0.[4] Also, there is a branch for Harmony v6.0 in development for Java SE 6.0.

Apache Harmony developers integrate several existing, field-tested open-source projects to meet their goal (not reinventing the wheel). Many of these projects are mature and well known and other parts of the library needed to be written from scratch.

This is a list of existing open source components that are used in the Apache Harmony project; some of them were in use before the project started.

Component Description
ICU Mature C/C++ and Java libraries for Unicode support and software internationalization and globalization
Apache Xalan XSLT stylesheet processor for Java, C++ which implements XPath language
[Apache Xerces XML parser library for Java, C++, Perl
Apache Portable Runtime Cross-platform abstraction library, provides platform independence
Apache CXF Robust, high performance Web services framework work over protocols such as SOAP, XML/HTTP, RESTful HTTP, CORBA
BCEL Libraries to decompose, modify, and recompose binary Java classes, i.e., bytecode
MX4J Java Management Extensions (JMX) tools to manage and monitor applications, system objects, devices and service-oriented networks
VM Magic Set of extensions to Java language to facilitate systems programming in Java by adding direct memory operations, etc.
Bouncy Castle Libraries collection of lightweight cryptography for Java and C#
ANTLR Language tool, provides a framework to construct recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in many target languages

### Documentation

Harmony is currently less documented than the alternative free Java implementations. For instance, in GNU Classpath every method of the central CORBA class (ORB) has the explaining comment both in the standard abstract API class[5] and implementation.[6] In the Yoko project, used by Harmony,[7] most methods both in the standard declaration[8] and implementing class[9] were undocumented at the end of October 2006. Also, GNU Classpath supported both older and current CORBA features (same as Sun's implementation). Harmony, differently, left the central method of the older standard (ORB.connect(Object)) fully unimplemented.

### Tools

A complete implementation of the Java platform also needs a compiler that translates Java source code into bytecodes, a program that manages JAR files, a debugger, and an applet viewer and web browser plugin, to name a few. Harmony currently has the compiler, appletviewer, jarsigner, javah, javap, keytool, policytool, and unpack200 [1].

### Virtual machine support

Harmony currently has seven virtual machine implementations that run Harmony Class Library, all of which were donations by external groups:

• JC Harmony Edition VM, "JCHEVM," based on the JCVM's interpreter, contributed by the author, Archie Cobbs.
• BootJVM, a simple bootstrapping virtual machine, contributed by Daniel Lydick.
• SableVM, an advanced, portable interpreter, contributed by authors from the Sable Research Group; and the Dynamic Runtime Layer Virtual Machine.
• DRLVM, a just-in-time compiler contributed by Intel.
• BEA announced the availability of an evaluation version of JRockit VM running Apache Harmony Class Library.[10]
• JikesRVM, an open-source meta-circular JVM that use the Apache Harmony Class Library.[11]
• Ja.NET SE, an open source project providing a Java 5 JDK (class libraries, tools, etc.) that run on the .NET Framework CLR. Ja.NET SE is based on the Apache Harmony Class Libraries.[12]

In the end of November 2006, the language support provided by these virtual machine was still incomplete, and the build instructions recommended to use IBM's proprietary J9 instead to run the class library test suite. However, this is not necessary anymore (as of July 2007).

As for the rest of the project, DRLVM virtual machine development has now stalled (as of May 2011).[13]

## Getting Started For Users

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

There are basic instructions for people that still wish to use Apache Harmony for running their Java programs. The steps described below neither require development tools nor necessitate compiling source code.

For more information on how to get you machine configured to build and work with the Apache Harmony source code, refer to Getting Started For Contributors.

The required dependencies are listed below per platform.

Currently, the Apache Harmony project has no formal releases of its software. Instead, the project offers pre-built snapshots that are expected to run well on the platforms offered.

#### 2. Unpack the Binary Distribution

Once you have obtained the appropriate binary distribution, you need to unpack it on your machine. In all cases, the distribution will unpack into a jre directory. Further in the document we refer to this directory as the root directory of the distribution.

Linux Users:
Use the tar program as follows:

$tar -tzf latest-harmony-jre-linux.tar.gz This will unpack the JRE directory tree into the current directory. Windows Users: Use one of zip utilities available for Windows to unpack the distribution. To create the JRE directory tree, extract the distribution zip file using the utility. #### 3. Configuring Your Environment Apache Harmony requires no further environmental setup, but sometimes other programs do. Also, it is convenient to have the Apache Harmony executables on your path. To set your JAVA_HOME and PATH environment variables, use the commands appropriate to your operating system and/or shell you are using. Linux Users The following command works for the Bash shell: $ cd jre
$export JAVA_HOME=pwd$ cd bin
$export PATH=pwd:$PATH

The given command assumes your current directory is the parent directory of the Harmony JRE. Note The  character is a backtick character, not an apostrophe.

Windows Users The following example assumes you unpacked the zip file into the root directory C:\. Please adjust as necessary.

C:\> set JAVA_HOME=C:\jre
C:\> set PATH=C:\jre\bin;%PATH%

#### 4. Using Apache Harmony

After performing aforementioned steps, you should be ready to use Apache Harmony. Try running your Java application:

$java Foo$ java -jar myjar.jar

In addition to standard options, you can use custom command-line options to adjust operation of the VM.

### Harmony JRE Command-Line Options

Command-Line options can be either standard or non-standard. While the first set is valid for any JVM the second set of options are specific for a particular VM. This document provides information on command-line options supported by the DRL virtual machine (DRLVM), including component-specific options and properties that can be used during code development and issue evaluation.

#### Standard JRE Options

To get the list of standard JRE options, run DRLVM with the -help option:

java -help

### Installation video

#### Non-standard JRE Options

Harmony non-standard options can be divided into the following groups:

• "-X" options are commonly used non-standard options. To get the list of non-standard JRE options supported by DRLVM run the VM with the -X option:
java -X`
• "-XX" options are non-standard component-specific options.

## Application status

Since its conception, Harmony grew in its ability to execute non-trivial Java applications.[14], supported applications include:

• Eclipse: 99.3% of the 36000 reference implementation (RI) test pass on Harmony's DRLVM + class library.[15]
• Apache Tomcat: 100% of the RI tests pass.[16]
• JUnit: 100% of the RI tests pass.[17]
• Apache Ant: 97% of the RI tests pass.[18]
• Other applications pass with a high success rate, such as Apache Derby, Apache Axis, Log4j, Apache Velocity, Apache Cocoon, jEdit, and Apache Commons.

However, Harmony's incomplete library prevented it from launching some other applications:

• ArgoUML: because it needs a Java applet implementation, which was still unavailable in Harmony.
• Apache Geronimo runs on Apache Harmony with some issues and workarounds.[19]
• Vuze, formerly Azureus, because of unimplemented security classes.