當前位置: 首頁>>技術教程>>正文


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/zh-tw/article/12245.html,未經允許,請勿轉載。