How do I find what package provides `javac`?












0















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?










share|improve this question























  • Possible duplicate of How do I find the package that provides a file?

    – Sergiy Kolodyazhnyy
    yesterday
















0















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?










share|improve this question























  • Possible duplicate of How do I find the package that provides a file?

    – Sergiy Kolodyazhnyy
    yesterday














0












0








0








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?










share|improve this question














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?







package-management java






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked yesterday









Borea DeitzBorea Deitz

32




32













  • Possible duplicate of How do I find the package that provides a file?

    – Sergiy Kolodyazhnyy
    yesterday



















  • Possible duplicate of How do I find the package that provides a file?

    – Sergiy Kolodyazhnyy
    yesterday

















Possible duplicate of How do I find the package that provides a file?

– Sergiy Kolodyazhnyy
yesterday





Possible duplicate of How do I find the package that provides a file?

– Sergiy Kolodyazhnyy
yesterday










2 Answers
2






active

oldest

votes


















1














In some cases, additional sleuthing is required. In particular,



$ ls -l $(which javac)
lrwxrwxrwx 1 root root 23 May 24 2017 /usr/bin/javac -> /etc/alternatives/javac


shows that /usr/bin/javac is a symbolic link - so we can either use readlink to drill down:



$ dpkg -S "$(readlink -f $(which javac))"
openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac


or (seeing as it's an update-alternatives link)



$ update-alternatives --query javac
Name: javac
Link: /usr/bin/javac
Slaves:
javac.1.gz /usr/share/man/man1/javac.1.gz
Status: auto
Best: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
Value: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac

Alternative: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
Priority: 1081
Slaves:
javac.1.gz /usr/lib/jvm/java-8-openjdk-amd64/man/man1/javac.1.gz


from which we can pick out the current value:



$ dpkg -S /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac





share|improve this answer
























  • Very nice. This was the issue. dpkg -S "$(readlink -f $(which javac))" worked, and the package is openjdk-7-jdk (confirmed by apt-cache policy). Thanks!

    – Borea Deitz
    yesterday











  • You should use realpath to simplify your process: dpkg -S "$(realpath $(which javac))".

    – Fólkvangr
    20 hours ago





















0














Looks like /usr/bin/javac is a symlink managed by update-alternatives. What do you see if you readlink -f /usr/bin/javac? If it's pointing somewhere else, perhaps check that location with dpkg -S? Or update-alternatives itself can tell you which options you have for a particular link, eg:



$ update-alternatives --config javac
There is only one alternative in link group javac (providing /usr/bin/javac): /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
Nothing to configure.


So then:



$ dpkg -S /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac


All files in that package: https://packages.ubuntu.com/xenial/openjdk-8-jdk-headless/filelist






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1116486%2fhow-do-i-find-what-package-provides-javac%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    In some cases, additional sleuthing is required. In particular,



    $ ls -l $(which javac)
    lrwxrwxrwx 1 root root 23 May 24 2017 /usr/bin/javac -> /etc/alternatives/javac


    shows that /usr/bin/javac is a symbolic link - so we can either use readlink to drill down:



    $ dpkg -S "$(readlink -f $(which javac))"
    openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac


    or (seeing as it's an update-alternatives link)



    $ update-alternatives --query javac
    Name: javac
    Link: /usr/bin/javac
    Slaves:
    javac.1.gz /usr/share/man/man1/javac.1.gz
    Status: auto
    Best: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    Value: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac

    Alternative: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    Priority: 1081
    Slaves:
    javac.1.gz /usr/lib/jvm/java-8-openjdk-amd64/man/man1/javac.1.gz


    from which we can pick out the current value:



    $ dpkg -S /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac





    share|improve this answer
























    • Very nice. This was the issue. dpkg -S "$(readlink -f $(which javac))" worked, and the package is openjdk-7-jdk (confirmed by apt-cache policy). Thanks!

      – Borea Deitz
      yesterday











    • You should use realpath to simplify your process: dpkg -S "$(realpath $(which javac))".

      – Fólkvangr
      20 hours ago


















    1














    In some cases, additional sleuthing is required. In particular,



    $ ls -l $(which javac)
    lrwxrwxrwx 1 root root 23 May 24 2017 /usr/bin/javac -> /etc/alternatives/javac


    shows that /usr/bin/javac is a symbolic link - so we can either use readlink to drill down:



    $ dpkg -S "$(readlink -f $(which javac))"
    openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac


    or (seeing as it's an update-alternatives link)



    $ update-alternatives --query javac
    Name: javac
    Link: /usr/bin/javac
    Slaves:
    javac.1.gz /usr/share/man/man1/javac.1.gz
    Status: auto
    Best: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    Value: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac

    Alternative: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    Priority: 1081
    Slaves:
    javac.1.gz /usr/lib/jvm/java-8-openjdk-amd64/man/man1/javac.1.gz


    from which we can pick out the current value:



    $ dpkg -S /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac





    share|improve this answer
























    • Very nice. This was the issue. dpkg -S "$(readlink -f $(which javac))" worked, and the package is openjdk-7-jdk (confirmed by apt-cache policy). Thanks!

      – Borea Deitz
      yesterday











    • You should use realpath to simplify your process: dpkg -S "$(realpath $(which javac))".

      – Fólkvangr
      20 hours ago
















    1












    1








    1







    In some cases, additional sleuthing is required. In particular,



    $ ls -l $(which javac)
    lrwxrwxrwx 1 root root 23 May 24 2017 /usr/bin/javac -> /etc/alternatives/javac


    shows that /usr/bin/javac is a symbolic link - so we can either use readlink to drill down:



    $ dpkg -S "$(readlink -f $(which javac))"
    openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac


    or (seeing as it's an update-alternatives link)



    $ update-alternatives --query javac
    Name: javac
    Link: /usr/bin/javac
    Slaves:
    javac.1.gz /usr/share/man/man1/javac.1.gz
    Status: auto
    Best: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    Value: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac

    Alternative: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    Priority: 1081
    Slaves:
    javac.1.gz /usr/lib/jvm/java-8-openjdk-amd64/man/man1/javac.1.gz


    from which we can pick out the current value:



    $ dpkg -S /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac





    share|improve this answer













    In some cases, additional sleuthing is required. In particular,



    $ ls -l $(which javac)
    lrwxrwxrwx 1 root root 23 May 24 2017 /usr/bin/javac -> /etc/alternatives/javac


    shows that /usr/bin/javac is a symbolic link - so we can either use readlink to drill down:



    $ dpkg -S "$(readlink -f $(which javac))"
    openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac


    or (seeing as it's an update-alternatives link)



    $ update-alternatives --query javac
    Name: javac
    Link: /usr/bin/javac
    Slaves:
    javac.1.gz /usr/share/man/man1/javac.1.gz
    Status: auto
    Best: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    Value: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac

    Alternative: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    Priority: 1081
    Slaves:
    javac.1.gz /usr/lib/jvm/java-8-openjdk-amd64/man/man1/javac.1.gz


    from which we can pick out the current value:



    $ dpkg -S /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered yesterday









    steeldriversteeldriver

    67.5k11110181




    67.5k11110181













    • Very nice. This was the issue. dpkg -S "$(readlink -f $(which javac))" worked, and the package is openjdk-7-jdk (confirmed by apt-cache policy). Thanks!

      – Borea Deitz
      yesterday











    • You should use realpath to simplify your process: dpkg -S "$(realpath $(which javac))".

      – Fólkvangr
      20 hours ago





















    • Very nice. This was the issue. dpkg -S "$(readlink -f $(which javac))" worked, and the package is openjdk-7-jdk (confirmed by apt-cache policy). Thanks!

      – Borea Deitz
      yesterday











    • You should use realpath to simplify your process: dpkg -S "$(realpath $(which javac))".

      – Fólkvangr
      20 hours ago



















    Very nice. This was the issue. dpkg -S "$(readlink -f $(which javac))" worked, and the package is openjdk-7-jdk (confirmed by apt-cache policy). Thanks!

    – Borea Deitz
    yesterday





    Very nice. This was the issue. dpkg -S "$(readlink -f $(which javac))" worked, and the package is openjdk-7-jdk (confirmed by apt-cache policy). Thanks!

    – Borea Deitz
    yesterday













    You should use realpath to simplify your process: dpkg -S "$(realpath $(which javac))".

    – Fólkvangr
    20 hours ago







    You should use realpath to simplify your process: dpkg -S "$(realpath $(which javac))".

    – Fólkvangr
    20 hours ago















    0














    Looks like /usr/bin/javac is a symlink managed by update-alternatives. What do you see if you readlink -f /usr/bin/javac? If it's pointing somewhere else, perhaps check that location with dpkg -S? Or update-alternatives itself can tell you which options you have for a particular link, eg:



    $ update-alternatives --config javac
    There is only one alternative in link group javac (providing /usr/bin/javac): /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    Nothing to configure.


    So then:



    $ dpkg -S /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
    openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac


    All files in that package: https://packages.ubuntu.com/xenial/openjdk-8-jdk-headless/filelist






    share|improve this answer




























      0














      Looks like /usr/bin/javac is a symlink managed by update-alternatives. What do you see if you readlink -f /usr/bin/javac? If it's pointing somewhere else, perhaps check that location with dpkg -S? Or update-alternatives itself can tell you which options you have for a particular link, eg:



      $ update-alternatives --config javac
      There is only one alternative in link group javac (providing /usr/bin/javac): /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
      Nothing to configure.


      So then:



      $ dpkg -S /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
      openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac


      All files in that package: https://packages.ubuntu.com/xenial/openjdk-8-jdk-headless/filelist






      share|improve this answer


























        0












        0








        0







        Looks like /usr/bin/javac is a symlink managed by update-alternatives. What do you see if you readlink -f /usr/bin/javac? If it's pointing somewhere else, perhaps check that location with dpkg -S? Or update-alternatives itself can tell you which options you have for a particular link, eg:



        $ update-alternatives --config javac
        There is only one alternative in link group javac (providing /usr/bin/javac): /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
        Nothing to configure.


        So then:



        $ dpkg -S /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
        openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac


        All files in that package: https://packages.ubuntu.com/xenial/openjdk-8-jdk-headless/filelist






        share|improve this answer













        Looks like /usr/bin/javac is a symlink managed by update-alternatives. What do you see if you readlink -f /usr/bin/javac? If it's pointing somewhere else, perhaps check that location with dpkg -S? Or update-alternatives itself can tell you which options you have for a particular link, eg:



        $ update-alternatives --config javac
        There is only one alternative in link group javac (providing /usr/bin/javac): /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
        Nothing to configure.


        So then:



        $ dpkg -S /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
        openjdk-8-jdk-headless:amd64: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac


        All files in that package: https://packages.ubuntu.com/xenial/openjdk-8-jdk-headless/filelist







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        mikepurvismikepurvis

        221212




        221212






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1116486%2fhow-do-i-find-what-package-provides-javac%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            數位音樂下載

            格利澤436b

            When can things happen in Etherscan, such as the picture below?