“-bash: javac: command not found” error after installing OpenJDK 1.7

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have CentOS 6.7. I have installed Java 1.8. When I do Java -version I see the following output.




java version "1.8.0_121"



Java(TM) SE Runtime Environment (build 1.8.0_121-b13)



Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)




I need javac so I came to know that this is available only if I install JDK. So I installed JDK by executing the following command




yum install java-1.7.0-openjdk-devel




The installation was successful. But now when I again execute the command java -version, I see the old result. If I try to execute javac at the command prompt I see the error '-bash: javac: command not found'. I observed that OpenJDK was installed to the directory /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/bin. So, I set it to JAVA_HOME, but I still cannot execute javac command. What am I doing wrong here?










share|improve this question
























  • Although setting JAVA_HOME is necessary for running Java, executables are still searched in $PATH, not in $JAVA_HOME/bin.

    – Satō Katsura
    Apr 4 '17 at 10:36











  • I set the directory in the PATH variable, but I am getting the same error.

    – KurioZ7
    Apr 4 '17 at 10:40

















0















I have CentOS 6.7. I have installed Java 1.8. When I do Java -version I see the following output.




java version "1.8.0_121"



Java(TM) SE Runtime Environment (build 1.8.0_121-b13)



Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)




I need javac so I came to know that this is available only if I install JDK. So I installed JDK by executing the following command




yum install java-1.7.0-openjdk-devel




The installation was successful. But now when I again execute the command java -version, I see the old result. If I try to execute javac at the command prompt I see the error '-bash: javac: command not found'. I observed that OpenJDK was installed to the directory /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/bin. So, I set it to JAVA_HOME, but I still cannot execute javac command. What am I doing wrong here?










share|improve this question
























  • Although setting JAVA_HOME is necessary for running Java, executables are still searched in $PATH, not in $JAVA_HOME/bin.

    – Satō Katsura
    Apr 4 '17 at 10:36











  • I set the directory in the PATH variable, but I am getting the same error.

    – KurioZ7
    Apr 4 '17 at 10:40













0












0








0








I have CentOS 6.7. I have installed Java 1.8. When I do Java -version I see the following output.




java version "1.8.0_121"



Java(TM) SE Runtime Environment (build 1.8.0_121-b13)



Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)




I need javac so I came to know that this is available only if I install JDK. So I installed JDK by executing the following command




yum install java-1.7.0-openjdk-devel




The installation was successful. But now when I again execute the command java -version, I see the old result. If I try to execute javac at the command prompt I see the error '-bash: javac: command not found'. I observed that OpenJDK was installed to the directory /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/bin. So, I set it to JAVA_HOME, but I still cannot execute javac command. What am I doing wrong here?










share|improve this question
















I have CentOS 6.7. I have installed Java 1.8. When I do Java -version I see the following output.




java version "1.8.0_121"



Java(TM) SE Runtime Environment (build 1.8.0_121-b13)



Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)




I need javac so I came to know that this is available only if I install JDK. So I installed JDK by executing the following command




yum install java-1.7.0-openjdk-devel




The installation was successful. But now when I again execute the command java -version, I see the old result. If I try to execute javac at the command prompt I see the error '-bash: javac: command not found'. I observed that OpenJDK was installed to the directory /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/bin. So, I set it to JAVA_HOME, but I still cannot execute javac command. What am I doing wrong here?







centos software-installation java






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 4 '17 at 10:18









Jeff Schaller

44.7k1162145




44.7k1162145










asked Apr 4 '17 at 9:47









KurioZ7KurioZ7

2585817




2585817












  • Although setting JAVA_HOME is necessary for running Java, executables are still searched in $PATH, not in $JAVA_HOME/bin.

    – Satō Katsura
    Apr 4 '17 at 10:36











  • I set the directory in the PATH variable, but I am getting the same error.

    – KurioZ7
    Apr 4 '17 at 10:40

















  • Although setting JAVA_HOME is necessary for running Java, executables are still searched in $PATH, not in $JAVA_HOME/bin.

    – Satō Katsura
    Apr 4 '17 at 10:36











  • I set the directory in the PATH variable, but I am getting the same error.

    – KurioZ7
    Apr 4 '17 at 10:40
















Although setting JAVA_HOME is necessary for running Java, executables are still searched in $PATH, not in $JAVA_HOME/bin.

– Satō Katsura
Apr 4 '17 at 10:36





Although setting JAVA_HOME is necessary for running Java, executables are still searched in $PATH, not in $JAVA_HOME/bin.

– Satō Katsura
Apr 4 '17 at 10:36













I set the directory in the PATH variable, but I am getting the same error.

– KurioZ7
Apr 4 '17 at 10:40





I set the directory in the PATH variable, but I am getting the same error.

– KurioZ7
Apr 4 '17 at 10:40










1 Answer
1






active

oldest

votes


















1














I have fixed this issue by executing the following command. I was not setting the PATH variable properly. I executed the following two commands and my problem was fixed.



export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64
export PATH=$JAVA_HOME/bin:$PATH





share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f355817%2fbash-javac-command-not-found-error-after-installing-openjdk-1-7%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    I have fixed this issue by executing the following command. I was not setting the PATH variable properly. I executed the following two commands and my problem was fixed.



    export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64
    export PATH=$JAVA_HOME/bin:$PATH





    share|improve this answer





























      1














      I have fixed this issue by executing the following command. I was not setting the PATH variable properly. I executed the following two commands and my problem was fixed.



      export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64
      export PATH=$JAVA_HOME/bin:$PATH





      share|improve this answer



























        1












        1








        1







        I have fixed this issue by executing the following command. I was not setting the PATH variable properly. I executed the following two commands and my problem was fixed.



        export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64
        export PATH=$JAVA_HOME/bin:$PATH





        share|improve this answer















        I have fixed this issue by executing the following command. I was not setting the PATH variable properly. I executed the following two commands and my problem was fixed.



        export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64
        export PATH=$JAVA_HOME/bin:$PATH






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 8 at 17:40









        Romeo Ninov

        6,93432129




        6,93432129










        answered Apr 4 '17 at 11:12









        KurioZ7KurioZ7

        2585817




        2585817



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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%2funix.stackexchange.com%2fquestions%2f355817%2fbash-javac-command-not-found-error-after-installing-openjdk-1-7%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

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay