当前位置: 首页>>技术教程>>正文


default-jdk、ecj、gcj和openjdk有什么区别?

, ,

问题描述

今天早上,我尝试安装一些东西并遇到这样的声明:

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>

default-jdk、ecj、gcj和openjdk有什么区别?

提前致谢。

最佳思路

default-jre

这是一个简单的包,它依赖于 openjdk-7-jre(因此基本上等同于 openjdk-7-jre)和 default-jre-headless。它安装“标准 Java 或 Java 兼容运行时”,即 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)

ecj

这是“独立的 Eclipse Java 编译器”。安装它不会安装 Eclipse,因为它是一个独立的包(请参阅下面的依赖项链接)。它包含“作为 Eclipse 一部分分发的 Eclipse JDT 编译器的独立版本”,并且与 Java 1.3 到 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.6-jdk

(gcj-4.7-jdk 是相同的,但对于 Java 7)

这是 GCC 编译器的前端,用于本地编译 Java 字节码和源文件。

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.

它旨在成为闭源 Oracle Java 编译器的开源替代品。它现在似乎已经过时和过时(未更新),请参阅下面的链接(特别是 GCJ 主页上的最新更新)。

Package information

Is GNU’s Java Compiler (GCJ) dead? – Stack Overflow GCJ home page on gnu.org(更新:链接现已消失,但 GCJ wiki is still available

openjdk-6-jdk

(openjdk-7-jdk 是相同的,但对于 Java 7)

Java 平台的开源版本。从 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.

套餐概要:

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


此外,您的问题中没有提到的是 Oracle Java(因为它不在默认存储库中),为了完整起见,我将在下面列出

oracle-java7-安装程序

(包名来自 Web Up8 PPA ,由 Oracle 在 .tar.gz 中分发)

Oracle(以前是 Sun)对 Java 的闭源 ‘official’ 实现。由于许可问题,未托管在官方存储库中。它由 Web Up8 作为脚本提供,可以为您下载并安装它。

How to install – Web Up8

次佳思路

我有同样的问题。我发现他们之间存在差异。

default-jdkopenjdk 更相似,因为它们具有相同的 Java API 代码。但不同之处在于目标平台。

  • 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.

但其他人则完全不同:它们只是编译器。他们之所以会出现,是因为一开始 Java 无法用于开源。只为 Eclipse 之类的东西发布了 cetain 编译器。

  • 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.

这个 ecj 不是 ECJ,它是 Java Evolutionary Computation Toolkit

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/12245.html,未经允许,请勿转载。