48

When I type for java -version in command prompt in ubuntu I get following output

The program 'java' can be found in the following packages:
 * default-jre
 * gcj-4.8-jre-headless
 * openjdk-7-jre-headless
 * gcj-4.6-jre-headless
 * openjdk-6-jre-headless
Try: apt-get install <selected package>

I get above output as I do not have java install. I want to know difference between openjdk-7-jre-headless and openjdk-7-jre

Mureinik
  • 297,002
  • 52
  • 306
  • 350
3ppps
  • 933
  • 1
  • 11
  • 24

3 Answers3

40

To quote debian's wiki:

There are several virtual packages used in Debian for Java. These cover runtime compatibility and come in two flavours; headless (omits graphical interfaces) and normal.

Or to be more exact, consider this description from Oracle:

Headless mode is a system configuration in which the display device, keyboard, or mouse is lacking. Sounds unexpected, but actually you can perform different operations in this mode, even with graphic data.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
26

As reported in this blog

Headless is the same version than the latter without the support of keyboard, mouse and display systems. Hence it has less dependencies and it makes it more suitable for server application.

abarisone
  • 3,707
  • 11
  • 35
  • 54
10

To add to previous answers the normal java depends on the headless and install some extra packages.

I tried to compare dependencies of:

  • java-1.8.0-openjdk-headless-1.8.0.191.b12-0.el7_5.x86_64
  • java-1.8.0-openjdk-1.8.0.191.b12-0.el7_5.x86_64

The comparison done with yum install on Centos 7.6

The normal Java (in contrast to headless) installed following extras:

=============================|========|=========================|============|=======|=================|
 Package                     | Arch   | Version                 | Repository |  Size | Vulnerabilities |
=============================|========|=========================|============|=======|=================|
 alsa-lib                    | x86_64 | 1.1.6-2.el7             | centos_7.6 | 424 k | 1 | 2005        |
 dejavu-fonts-common         | noarch | 2.33-6.el7              | centos_7.6 |  64 k | - |             |
 dejavu-sans-fonts           | noarch | 2.33-6.el7              | centos_7.6 | 1.4 M | - |             |
 fontconfig                  | x86_64 | 2.13.0-4.3.el7          | centos_7.6 | 254 k | 1 | 2016        |
 fontpackages-filesystem     | noarch | 1.44-8.el7              | centos_7.6 | 9.9 k | - |             |
 giflib                      | x86_64 | 4.1.6-9.el7             | centos_7.6 |  40 k | 5 | 2018        |
 java-1.8.0-openjdk-headless | x86_64 | 1:1.8.0.191.b12-0.el7_5 | centos_7.6 |  32 M | ? |             |
 libICE                      | x86_64 | 1.0.9-9.el7             | centos_7.6 |  66 k | 1 | 2018        |
 libSM                       | x86_64 | 1.2.2-2.el7             | centos_7.6 |  39 k | - |             |
 libX11                      | x86_64 | 1.6.5-2.el7             | centos_7.6 | 606 k | 3 | 2013        |
 libX11-common               | noarch | 1.6.5-2.el7             | centos_7.6 | 164 k |   |             |
 libXau                      | x86_64 | 1.0.8-2.1.el7           | centos_7.6 |  29 k |   |             |
 libXcomposite               | x86_64 | 0.4.4-4.1.el7           | centos_7.6 |  22 k |   |             |
 libXext                     | x86_64 | 1.3.3-3.el7             | centos_7.6 |  39 k |   |             |
 libXi                       | x86_64 | 1.7.9-1.el7             | centos_7.6 |  40 k |   |             |
 libXrender                  | x86_64 | 0.9.10-1.el7            | centos_7.6 |  26 k |   |             |
 libXtst                     | x86_64 | 1.2.3-1.el7             | centos_7.6 |  20 k |   |             |
 libfontenc                  | x86_64 | 1.1.3-3.el7             | centos_7.6 |  31 k |   |             |
 libxcb                      | x86_64 | 1.13-1.el7              | centos_7.6 | 214 k |   |             |
 ttmkfdir                    | x86_64 | 3.0.9-42.el7            | centos_7.6 |  48 k | - |             |
 xorg-x11-font-utils         | x86_64 | 1:7.5-21.el7            | centos_7.6 | 104 k | 1 | 2008        |
 xorg-x11-fonts-Type1        | noarch | 7.5-9.el7               | centos_7.6 | 521 k |   |             |
=============================|========|=========================|============|=======|=================| 

Note that java-1.8.0-openjdk-headless is a dependency of java-1.8.0-openjdk.
Also note that the concrete dependencies may differ on your system.

sumid
  • 1,871
  • 2
  • 25
  • 37