I'd like to find what package is installed on Ubuntu 14.04 (server) that gives access to the javac
command. The RHEL line of distros has yum provides
for this, but there doesn't seem to be anything similar for the Debian family.
This AskUbuntu question suggests using dpkg -S
and apt-file
, but neither of these work:
$ sudo dpkg -S `which javac`
dpkg-query: no path found matching pattern /usr/bin/javac
apt-file search
appears to work at first:
$ apt-file search javac
javacc: /usr/bin/javacc
Except that apt-cache policy
shows that this package isn't even installed, so it's obviously not the package that provides javac
.
$ apt-cache policy javacc
javacc:
Installed: (none)
Candidate: 5.0-5
How can I find out what package provides the javac
command?
In some cases, additional sleuthing is required. In particular,
shows that
/usr/bin/javac
is a symbolic link - so we can either usereadlink
to drill down:or (seeing as it's an
update-alternatives
link)from which we can pick out the current value:
Looks like
/usr/bin/javac
is a symlink managed byupdate-alternatives
. What do you see if youreadlink -f /usr/bin/javac
? If it's pointing somewhere else, perhaps check that location withdpkg -S
? Orupdate-alternatives
itself can tell you which options you have for a particular link, eg:So then:
All files in that package: https://packages.ubuntu.com/xenial/openjdk-8-jdk-headless/filelist