Ubuntu: What is the difference between default-jdk, ecj, gcj and openjdk?


This morning, I tried to install something and came across a statement like this:

The program 'javac' can be found in the following packages:   * default-jdk   * ecj   * gcj-4.6-jdk   * gcj-4.7-jdk   * openjdk-7-jdk   * openjdk-6-jdk  Try: sudo apt-get install <selected package>  

What is the difference between default-jdk, ecj, gcj and openjdk?

Thanks in advance.



This is a simple package which depends on openjdk-7-jre (and so is basically equivalent to openjdk-7-jre) and default-jre-headless. It installs the "Standard Java or Java compatible Runtime", which is OpenJDK 7 JRE.

This package points to the Java runtime, or Java compatible runtime recommended for the i386 architecture, which is openjdk-7-jre for i386.

Package information
Package dependencies (saucy)


This is the "standalone Eclipse Java compiler". Installing it will not install Eclipse, as it is a standalone package (see dependencies link below). It contains "a standalone version of the Eclipse JDT compiler which is distributed as part of Eclipse" and is compatible with Java 1.3 through to 1.7.

This package provides a standalone version of the Eclipse JDT compiler which is distributed as part of Eclipse. It passes the JCK (Java Compatibility Kit) and is compatible with Java 1.3, 1.4, 1.5, 1.6 and 1.7.

Package information
Package dependencies (saucy)


(gcj-4.7-jdk is the same but for Java 7)

This is a frontend to the GCC compiler to natively compile Java bytecode and source files.

GCJ is a front end to the GCC compiler which can natively compile both Java(tm) source and bytecode files. The compiler can also generate class files. Other java development tools from classpath are included in this package.

The package contains as well a collection of wrapper scripts and symlinks. It is meant to provide a Java-SDK-like interface to the GCJ tool set.

It was meant to be an open source alternative to the closed source Oracle Java compiler. It seems to be mostly obselete and outdated (not updated) now, see links below (particularly the last updates on the GCJ home page).

Package information

Is GNU's Java Compiler (GCJ) dead? - Stack Overflow
GCJ home page on gnu.org (Update: The link is gone now, but GCJ wiki is still available


(openjdk-7-jdk is the same but for Java 7)

An open source version of the Java platform.
From the Wiki:

The primary goal of the OpenJDK project is to produce an open-source implementation of the Java SE Platform (6 and 7). This is the default version of Java that Ubuntu uses and is the easiest to install.

Package summary:

OpenJDK is a development environment for building applications, applets, and components using the Java programming language.

The packages are built using the IcedTea build support and patches from the IcedTea project.

Package information

Also, not mentioned in your question was Oracle Java (because it isn't in the default repos), which I'll list below for completeness


(package name from Web Up8 PPA, distributed by Oracle in .tar.gz)

The closed source 'official' implementation of Java by Oracle (previously Sun). Not hosted in the official repos due to licensing issues. It was made available by Web Up8 as a script which downloads and installs it for you.

How to install - Web Up8


I had the same problem. What I found was that they are having differences from one to other.

Both default-jdk and openjdk are more similar as they having same java API codes. But difference is in the target platform.

  • openjdk : Is the most stable one. It was designed for all the platforms. It is basically targeting Open-source platforms.

  • default-jdk : Is not stable. It was designed aiming certain target platforms. It is basically targeting Closed platforms.( Was later available for Open-Source) JRE s are in this.

But others are totally different: They are just Compilers. They were known to came because, at the beginning Java was not available for Open-Source. Only cetain compilers were released for things like Eclipse.

  • gcj -jdk : (GNU Compiler for Java). It is a compiler for Java in GNU.(Used by Java)

  • ecj : (Eclipse Java Compiler) Is the Java compiler used by Eclipse.

This ecj is Not ECJ which is Java Evolutionary Computation Toolkit

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »