106

I am having trouble understanding some of the basics of Java JRE.

I need to run Java code in an embedded system and for this I need a minimal Java Runtime Environment installed in a Linux kernel, that is to say, the minimum package necessary for executing Java binaries. I think it is not possible to do this only with a JVM (the JRE package is necessary, am I wrong here?)

The thing is, when looking at the Debian repositories I don't quite understand the differences between the packages openjdk-6-jre, openjdk-6-jre-headless and openjdk-6-jre-lib. Will Java programs run only with the former? or, are the three of them needed?

This is an issue as there is a big difference in size (MB) between them.

Raedwald
  • 46,613
  • 43
  • 151
  • 237
Jorge
  • 1,350
  • 2
  • 10
  • 19

2 Answers2

113

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

Woodham
  • 4,053
  • 2
  • 20
  • 15
  • Thank you very much. Actually I have to compile a linux kernel 2.6... for this platform and I am not sure if it is possible to incorporate in the build process the jre (whatever version, lowest in size if possible). Do you know if this is possible? – Jorge Jun 18 '14 at 09:12
  • 2
    If you mean include a jre with the kernel then as far as I know that's not possible - the jre lives in userspace not the kernel. – Woodham Jun 18 '14 at 09:39
  • The link reports error: "two or more packages specified (openjdk-6-jre-headless squeeze)". – Muhamed Huseinbašić Jan 12 '17 at 15:17
  • what about the differences between `openjdk-11-jdk-headless` and `openjdk-11-jdk` on Linux(ubuntu 18.10), where we can find relative information? – christianbueno.1 Dec 31 '18 at 20:11
  • You can search for ubuntu packages here: https://packages.ubuntu.com/ The relevant ones you're looking for are https://packages.ubuntu.com/cosmic/openjdk-11-jdk-headless and https://packages.ubuntu.com/cosmic/openjdk-11-jdk – Woodham Jan 02 '19 at 14:09
  • You can also use the `site:` filter from your preferred search engine, if it supports it, to find package details with following search term: `site:packages.ubuntu.com "package name of interest"` for ubuntu or `site:packages.debian.org "package name of interest"` for debian and similarly for other distributions – Pau Coma Ramirez Mar 21 '21 at 10:23
  • @Woodham The links in your answer seem to be broken. Please check and update them if you can. – Paulo Merson Sep 15 '22 at 11:30
16

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.

Daniel
  • 27,718
  • 20
  • 89
  • 133