Openjdk-6-jre,openjdk-6-jre-headless,openjdk-6-jre-lib 之间的区别

我在理解 JavaJRE 的一些基础知识方面遇到了困难。

我需要在嵌入式系统中运行 Java 代码,为此我需要在 Linux 内核中安装最小的 JRE,也就是说,执行 Java 二进制文件所需的最小包。我认为只使用 JVM 是不可能做到这一点的(JRE 包是必要的,我这里错了吗?)

问题是,在查看 Debian 存储库时,我不太明白软件包 openjdk-6-jreopenjdk-6-jre-headlessopenjdk-6-jre-lib之间的区别。Java 程序只能使用前者吗?还是需要他们三个?

这是一个问题,因为它们之间的大小(MB)有很大的差异。

71534 次浏览

You are correct in that you will need a JRE package to run any Java application.

Since you say you're running on an embedded platform I assume that the Java application you want to run has no GUI. In that case, you will be fine with openjdk-6-jre-headless. This is explained on the openjdk-6-jre-headless package page here "Minimal Java runtime - needed for executing non GUI Java programs".

As you can see from the debian package details page, openjdk-6-jre-headless depends on openjdk-6-jre-lib (among other packages), so that will get installed either way.

If however the Java application you want to run has a GUI, you will need openjdk-6-jre instead of openjdk-6-jre-headless

The main reason for having two distinct packages available are the dependencies of the packages. openjdk-6-jre will also depend on:

libasound2, libgif4, libjpeg62, libpng12-0, libpulse0 , libx11-6, libxext6, libxi6, libxrender1, libxtst6 and zlib1g

And contrary to the previous comment openjdk-6-jre depends on openjdk-6-jre-headless, making the latter really just a subset.