Struggling with Duplicate Java JRE version on Ubuntu

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








up vote
0
down vote

favorite












I have installed java jdk 9 and java jre 9 on ubuntu and set the path of both to /etc/environment as /usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin then I tested javac -version which prints jdk9 but when I run java -version it prints



openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)


I don't know where the openjdk is installed. I think it is installed with the MAVEN.



Here is the /etc/environment content



PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/jdk-9.0.4/bin"
JAVA_HOME="/usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin"









share|improve this question





















  • How did you install jdk/jre9? Via apt? What is the output of update-java-alternatives --list (may need sudo, but not sure)?
    – danzel
    Mar 21 at 11:05










  • openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
    – Asif Mushtaq
    Mar 21 at 11:43














up vote
0
down vote

favorite












I have installed java jdk 9 and java jre 9 on ubuntu and set the path of both to /etc/environment as /usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin then I tested javac -version which prints jdk9 but when I run java -version it prints



openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)


I don't know where the openjdk is installed. I think it is installed with the MAVEN.



Here is the /etc/environment content



PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/jdk-9.0.4/bin"
JAVA_HOME="/usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin"









share|improve this question





















  • How did you install jdk/jre9? Via apt? What is the output of update-java-alternatives --list (may need sudo, but not sure)?
    – danzel
    Mar 21 at 11:05










  • openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
    – Asif Mushtaq
    Mar 21 at 11:43












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have installed java jdk 9 and java jre 9 on ubuntu and set the path of both to /etc/environment as /usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin then I tested javac -version which prints jdk9 but when I run java -version it prints



openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)


I don't know where the openjdk is installed. I think it is installed with the MAVEN.



Here is the /etc/environment content



PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/jdk-9.0.4/bin"
JAVA_HOME="/usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin"









share|improve this question













I have installed java jdk 9 and java jre 9 on ubuntu and set the path of both to /etc/environment as /usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin then I tested javac -version which prints jdk9 but when I run java -version it prints



openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)


I don't know where the openjdk is installed. I think it is installed with the MAVEN.



Here is the /etc/environment content



PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/jdk-9.0.4/bin"
JAVA_HOME="/usr/local/jdk-9.0.4:/usr/local/jre-9.0.4/bin"






software-installation java jdk openjdk






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 21 at 7:58









Asif Mushtaq

1011




1011











  • How did you install jdk/jre9? Via apt? What is the output of update-java-alternatives --list (may need sudo, but not sure)?
    – danzel
    Mar 21 at 11:05










  • openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
    – Asif Mushtaq
    Mar 21 at 11:43
















  • How did you install jdk/jre9? Via apt? What is the output of update-java-alternatives --list (may need sudo, but not sure)?
    – danzel
    Mar 21 at 11:05










  • openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
    – Asif Mushtaq
    Mar 21 at 11:43















How did you install jdk/jre9? Via apt? What is the output of update-java-alternatives --list (may need sudo, but not sure)?
– danzel
Mar 21 at 11:05




How did you install jdk/jre9? Via apt? What is the output of update-java-alternatives --list (may need sudo, but not sure)?
– danzel
Mar 21 at 11:05












openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
– Asif Mushtaq
Mar 21 at 11:43




openJDK install automatically when I installed maven. but the other version java 9 is installed in /usr/local by self. extracting the zip file there.
– Asif Mushtaq
Mar 21 at 11:43










1 Answer
1






active

oldest

votes

















up vote
1
down vote













When you installed maven, openjdk-8-jre-headless was installed as a dependency. The Java Runtime Environment (jre) does include the java binary, but not the Java compiler (javac). The java binary (or, to be more specific, a link to it) now resides in /usr/bin. Since the PATH-variable is processed left-to-right, executing java executes /usr/bin/java, whereas javac executes /usr/local/jdk-9.0.4/bin/javac because it was not found in any other folder contained in PATH. You can check this yourself using the which command, e.g. which java or which javac.



The openjdk8 jre is most likely installed in /usr/lib/jvm/java-8... and its binaries are linked in /usr/bin by the Debian Alternatives System.






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',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    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%2f1017860%2fstruggling-with-duplicate-java-jre-version-on-ubuntu%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    When you installed maven, openjdk-8-jre-headless was installed as a dependency. The Java Runtime Environment (jre) does include the java binary, but not the Java compiler (javac). The java binary (or, to be more specific, a link to it) now resides in /usr/bin. Since the PATH-variable is processed left-to-right, executing java executes /usr/bin/java, whereas javac executes /usr/local/jdk-9.0.4/bin/javac because it was not found in any other folder contained in PATH. You can check this yourself using the which command, e.g. which java or which javac.



    The openjdk8 jre is most likely installed in /usr/lib/jvm/java-8... and its binaries are linked in /usr/bin by the Debian Alternatives System.






    share|improve this answer
























      up vote
      1
      down vote













      When you installed maven, openjdk-8-jre-headless was installed as a dependency. The Java Runtime Environment (jre) does include the java binary, but not the Java compiler (javac). The java binary (or, to be more specific, a link to it) now resides in /usr/bin. Since the PATH-variable is processed left-to-right, executing java executes /usr/bin/java, whereas javac executes /usr/local/jdk-9.0.4/bin/javac because it was not found in any other folder contained in PATH. You can check this yourself using the which command, e.g. which java or which javac.



      The openjdk8 jre is most likely installed in /usr/lib/jvm/java-8... and its binaries are linked in /usr/bin by the Debian Alternatives System.






      share|improve this answer






















        up vote
        1
        down vote










        up vote
        1
        down vote









        When you installed maven, openjdk-8-jre-headless was installed as a dependency. The Java Runtime Environment (jre) does include the java binary, but not the Java compiler (javac). The java binary (or, to be more specific, a link to it) now resides in /usr/bin. Since the PATH-variable is processed left-to-right, executing java executes /usr/bin/java, whereas javac executes /usr/local/jdk-9.0.4/bin/javac because it was not found in any other folder contained in PATH. You can check this yourself using the which command, e.g. which java or which javac.



        The openjdk8 jre is most likely installed in /usr/lib/jvm/java-8... and its binaries are linked in /usr/bin by the Debian Alternatives System.






        share|improve this answer












        When you installed maven, openjdk-8-jre-headless was installed as a dependency. The Java Runtime Environment (jre) does include the java binary, but not the Java compiler (javac). The java binary (or, to be more specific, a link to it) now resides in /usr/bin. Since the PATH-variable is processed left-to-right, executing java executes /usr/bin/java, whereas javac executes /usr/local/jdk-9.0.4/bin/javac because it was not found in any other folder contained in PATH. You can check this yourself using the which command, e.g. which java or which javac.



        The openjdk8 jre is most likely installed in /usr/lib/jvm/java-8... and its binaries are linked in /usr/bin by the Debian Alternatives System.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 21 at 15:03









        danzel

        1,386512




        1,386512



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1017860%2fstruggling-with-duplicate-java-jre-version-on-ubuntu%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            pylint3 and pip3 broken

            Missing snmpget and snmpwalk

            How to enroll fingerprints to Ubuntu 17.10 with VFS491