How can I reload java module

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












1















We are building a java source. When we build it with the official repo of Ubuntu it actually installs 10.0.2. see



-------- which javac ---------------
/usr/lib/jvm/java-11-openjdk-amd64/bin/javac


-------- java -version ---------------
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)`


We need to use java 11 so we build it the way we did.



We want to find a way to reload java jdk in the following without restarting.

We would like to replace shutdown -r with some type of source or something in the following:



sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-11-jdk
shutdown -r
sudo update-alternatives --config java
sudo update-alternatives --config javac


Because after a restart java -version shows openjdk version '11.0.1" 2018-10-16



What would do that?










share|improve this question
























  • Please explain and demonstrate why this is not getting updated after updating alternatives but before a reboot... (e.g. include output of java -version.) Typically alternatives system will maintain symlinks (and not $PATH settings), so the update should be available globally and immediately, since the path of the new Java is the same as the old one... But maybe the Java package is using alternatives for a file that defines environment variables... (?) Can you list what files are being managed by alternatives for "java" and "javac"?

    – filbranden
    Feb 23 at 6:52











  • @filbranden I can't really demonstrate at this point because uninstalling and re-installing "openjdk11" from cononical installs 10.0.1 and the ppa actually installs 11.0.1 and that would reak havoc. The explanation is above.

    – Zach
    Feb 23 at 19:15















1















We are building a java source. When we build it with the official repo of Ubuntu it actually installs 10.0.2. see



-------- which javac ---------------
/usr/lib/jvm/java-11-openjdk-amd64/bin/javac


-------- java -version ---------------
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)`


We need to use java 11 so we build it the way we did.



We want to find a way to reload java jdk in the following without restarting.

We would like to replace shutdown -r with some type of source or something in the following:



sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-11-jdk
shutdown -r
sudo update-alternatives --config java
sudo update-alternatives --config javac


Because after a restart java -version shows openjdk version '11.0.1" 2018-10-16



What would do that?










share|improve this question
























  • Please explain and demonstrate why this is not getting updated after updating alternatives but before a reboot... (e.g. include output of java -version.) Typically alternatives system will maintain symlinks (and not $PATH settings), so the update should be available globally and immediately, since the path of the new Java is the same as the old one... But maybe the Java package is using alternatives for a file that defines environment variables... (?) Can you list what files are being managed by alternatives for "java" and "javac"?

    – filbranden
    Feb 23 at 6:52











  • @filbranden I can't really demonstrate at this point because uninstalling and re-installing "openjdk11" from cononical installs 10.0.1 and the ppa actually installs 11.0.1 and that would reak havoc. The explanation is above.

    – Zach
    Feb 23 at 19:15













1












1








1








We are building a java source. When we build it with the official repo of Ubuntu it actually installs 10.0.2. see



-------- which javac ---------------
/usr/lib/jvm/java-11-openjdk-amd64/bin/javac


-------- java -version ---------------
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)`


We need to use java 11 so we build it the way we did.



We want to find a way to reload java jdk in the following without restarting.

We would like to replace shutdown -r with some type of source or something in the following:



sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-11-jdk
shutdown -r
sudo update-alternatives --config java
sudo update-alternatives --config javac


Because after a restart java -version shows openjdk version '11.0.1" 2018-10-16



What would do that?










share|improve this question
















We are building a java source. When we build it with the official repo of Ubuntu it actually installs 10.0.2. see



-------- which javac ---------------
/usr/lib/jvm/java-11-openjdk-amd64/bin/javac


-------- java -version ---------------
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)`


We need to use java 11 so we build it the way we did.



We want to find a way to reload java jdk in the following without restarting.

We would like to replace shutdown -r with some type of source or something in the following:



sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-11-jdk
shutdown -r
sudo update-alternatives --config java
sudo update-alternatives --config javac


Because after a restart java -version shows openjdk version '11.0.1" 2018-10-16



What would do that?







java shutdown alternatives






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 23 at 22:09









Rui F Ribeiro

41.6k1483141




41.6k1483141










asked Feb 23 at 4:56









ZachZach

156




156












  • Please explain and demonstrate why this is not getting updated after updating alternatives but before a reboot... (e.g. include output of java -version.) Typically alternatives system will maintain symlinks (and not $PATH settings), so the update should be available globally and immediately, since the path of the new Java is the same as the old one... But maybe the Java package is using alternatives for a file that defines environment variables... (?) Can you list what files are being managed by alternatives for "java" and "javac"?

    – filbranden
    Feb 23 at 6:52











  • @filbranden I can't really demonstrate at this point because uninstalling and re-installing "openjdk11" from cononical installs 10.0.1 and the ppa actually installs 11.0.1 and that would reak havoc. The explanation is above.

    – Zach
    Feb 23 at 19:15

















  • Please explain and demonstrate why this is not getting updated after updating alternatives but before a reboot... (e.g. include output of java -version.) Typically alternatives system will maintain symlinks (and not $PATH settings), so the update should be available globally and immediately, since the path of the new Java is the same as the old one... But maybe the Java package is using alternatives for a file that defines environment variables... (?) Can you list what files are being managed by alternatives for "java" and "javac"?

    – filbranden
    Feb 23 at 6:52











  • @filbranden I can't really demonstrate at this point because uninstalling and re-installing "openjdk11" from cononical installs 10.0.1 and the ppa actually installs 11.0.1 and that would reak havoc. The explanation is above.

    – Zach
    Feb 23 at 19:15
















Please explain and demonstrate why this is not getting updated after updating alternatives but before a reboot... (e.g. include output of java -version.) Typically alternatives system will maintain symlinks (and not $PATH settings), so the update should be available globally and immediately, since the path of the new Java is the same as the old one... But maybe the Java package is using alternatives for a file that defines environment variables... (?) Can you list what files are being managed by alternatives for "java" and "javac"?

– filbranden
Feb 23 at 6:52





Please explain and demonstrate why this is not getting updated after updating alternatives but before a reboot... (e.g. include output of java -version.) Typically alternatives system will maintain symlinks (and not $PATH settings), so the update should be available globally and immediately, since the path of the new Java is the same as the old one... But maybe the Java package is using alternatives for a file that defines environment variables... (?) Can you list what files are being managed by alternatives for "java" and "javac"?

– filbranden
Feb 23 at 6:52













@filbranden I can't really demonstrate at this point because uninstalling and re-installing "openjdk11" from cononical installs 10.0.1 and the ppa actually installs 11.0.1 and that would reak havoc. The explanation is above.

– Zach
Feb 23 at 19:15





@filbranden I can't really demonstrate at this point because uninstalling and re-installing "openjdk11" from cononical installs 10.0.1 and the ppa actually installs 11.0.1 and that would reak havoc. The explanation is above.

– Zach
Feb 23 at 19:15










1 Answer
1






active

oldest

votes


















1














Rebooting should not be necessary.



Your sudo update-alternatives --config java command actually does most of the job of switching the default from one version of Java to the other. However, after that command, you might need to run hash -r to get the shell of the current session to forget its old idea of where the various executables actually are and start afresh. If the java command was used while the version 10.0.1 was still the latest one installed, the shell might have cached its location and keep using it until told otherwise, with either hash -r, logout/login, or a reboot (which is overkill for this purpose).



If your friend has added something in the login scripts that explicitly sets $JAVA_HOME or any other relevant environment variables, then logging out and back in might be necessary too.



So, I'd suggest the following procedure:



sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-11-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac
hash -r
java -version
<if still indicates an old version, then logout & login again>





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%2f502449%2fhow-can-i-reload-java-module%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














    Rebooting should not be necessary.



    Your sudo update-alternatives --config java command actually does most of the job of switching the default from one version of Java to the other. However, after that command, you might need to run hash -r to get the shell of the current session to forget its old idea of where the various executables actually are and start afresh. If the java command was used while the version 10.0.1 was still the latest one installed, the shell might have cached its location and keep using it until told otherwise, with either hash -r, logout/login, or a reboot (which is overkill for this purpose).



    If your friend has added something in the login scripts that explicitly sets $JAVA_HOME or any other relevant environment variables, then logging out and back in might be necessary too.



    So, I'd suggest the following procedure:



    sudo add-apt-repository ppa:openjdk-r/ppa
    sudo apt-get update
    sudo apt-get install openjdk-11-jdk
    sudo update-alternatives --config java
    sudo update-alternatives --config javac
    hash -r
    java -version
    <if still indicates an old version, then logout & login again>





    share|improve this answer



























      1














      Rebooting should not be necessary.



      Your sudo update-alternatives --config java command actually does most of the job of switching the default from one version of Java to the other. However, after that command, you might need to run hash -r to get the shell of the current session to forget its old idea of where the various executables actually are and start afresh. If the java command was used while the version 10.0.1 was still the latest one installed, the shell might have cached its location and keep using it until told otherwise, with either hash -r, logout/login, or a reboot (which is overkill for this purpose).



      If your friend has added something in the login scripts that explicitly sets $JAVA_HOME or any other relevant environment variables, then logging out and back in might be necessary too.



      So, I'd suggest the following procedure:



      sudo add-apt-repository ppa:openjdk-r/ppa
      sudo apt-get update
      sudo apt-get install openjdk-11-jdk
      sudo update-alternatives --config java
      sudo update-alternatives --config javac
      hash -r
      java -version
      <if still indicates an old version, then logout & login again>





      share|improve this answer

























        1












        1








        1







        Rebooting should not be necessary.



        Your sudo update-alternatives --config java command actually does most of the job of switching the default from one version of Java to the other. However, after that command, you might need to run hash -r to get the shell of the current session to forget its old idea of where the various executables actually are and start afresh. If the java command was used while the version 10.0.1 was still the latest one installed, the shell might have cached its location and keep using it until told otherwise, with either hash -r, logout/login, or a reboot (which is overkill for this purpose).



        If your friend has added something in the login scripts that explicitly sets $JAVA_HOME or any other relevant environment variables, then logging out and back in might be necessary too.



        So, I'd suggest the following procedure:



        sudo add-apt-repository ppa:openjdk-r/ppa
        sudo apt-get update
        sudo apt-get install openjdk-11-jdk
        sudo update-alternatives --config java
        sudo update-alternatives --config javac
        hash -r
        java -version
        <if still indicates an old version, then logout & login again>





        share|improve this answer













        Rebooting should not be necessary.



        Your sudo update-alternatives --config java command actually does most of the job of switching the default from one version of Java to the other. However, after that command, you might need to run hash -r to get the shell of the current session to forget its old idea of where the various executables actually are and start afresh. If the java command was used while the version 10.0.1 was still the latest one installed, the shell might have cached its location and keep using it until told otherwise, with either hash -r, logout/login, or a reboot (which is overkill for this purpose).



        If your friend has added something in the login scripts that explicitly sets $JAVA_HOME or any other relevant environment variables, then logging out and back in might be necessary too.



        So, I'd suggest the following procedure:



        sudo add-apt-repository ppa:openjdk-r/ppa
        sudo apt-get update
        sudo apt-get install openjdk-11-jdk
        sudo update-alternatives --config java
        sudo update-alternatives --config javac
        hash -r
        java -version
        <if still indicates an old version, then logout & login again>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 23 at 20:45









        telcoMtelcoM

        19.4k12448




        19.4k12448



























            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%2f502449%2fhow-can-i-reload-java-module%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?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?