What is the value of JAVA_HOME for CentOS?Installing Tomcat on CentOS 5When starting Tomcat it looks like two different JAVA_HOME paths are being concatenated togetherInstall Java EE 6 on CentOS 6Setting PATH environment variable not working in Fedora 17Puppet error on already installed package on centosChange java version for tomcat on centOSyum whatprovides does not return anythingCreate yum variable, that is the result of a command?How can I upgrade to Java 1.8 on an Amazon Linux Server?Tomcat service does not see $JAVA_HOME

Has there ever been an airliner design involving reducing generator load by installing solar panels?

What exploit are these user agents trying to use?

Would Slavery Reparations be considered Bills of Attainder and hence Illegal?

Why does Kotter return in Welcome Back Kotter?

Infinite Abelian subgroup of infinite non Abelian group example

Could gravitational lensing be used to protect a spaceship from a laser?

What is a clear way to write a bar that has an extra beat?

Is it unprofessional to ask if a job posting on GlassDoor is real?

Can a rocket refuel on Mars from water?

How could indestructible materials be used in power generation?

Blender 2.8 I can't see vertices, edges or faces in edit mode

What to put in ESTA if staying in US for a few days before going on to Canada

90's TV series where a boy goes to another dimension through portal near power lines

Alternative to sending password over mail?

What does it mean to describe someone as a butt steak?

Do I have a twin with permutated remainders?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Why is the 'in' operator throwing an error with a string literal instead of logging false?

Combinations of multiple lists

Is it inappropriate for a student to attend their mentor's dissertation defense?

Will google still index a page if I use a $_SESSION variable?

Does a druid starting with a bow start with no arrows?

What mechanic is there to disable a threat instead of killing it?

How do I write bicross product symbols in latex?



What is the value of JAVA_HOME for CentOS?


Installing Tomcat on CentOS 5When starting Tomcat it looks like two different JAVA_HOME paths are being concatenated togetherInstall Java EE 6 on CentOS 6Setting PATH environment variable not working in Fedora 17Puppet error on already installed package on centosChange java version for tomcat on centOSyum whatprovides does not return anythingCreate yum variable, that is the result of a command?How can I upgrade to Java 1.8 on an Amazon Linux Server?Tomcat service does not see $JAVA_HOME






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








36















I have install java through yum on CentOS, however another java programme needs to know what the JAVA_HOME environmental variable is. I know all about setting environmental variables, but what do I set it to? java is installed in /usr/bin/java, it can't be there!










share|improve this question




























    36















    I have install java through yum on CentOS, however another java programme needs to know what the JAVA_HOME environmental variable is. I know all about setting environmental variables, but what do I set it to? java is installed in /usr/bin/java, it can't be there!










    share|improve this question
























      36












      36








      36


      13






      I have install java through yum on CentOS, however another java programme needs to know what the JAVA_HOME environmental variable is. I know all about setting environmental variables, but what do I set it to? java is installed in /usr/bin/java, it can't be there!










      share|improve this question














      I have install java through yum on CentOS, however another java programme needs to know what the JAVA_HOME environmental variable is. I know all about setting environmental variables, but what do I set it to? java is installed in /usr/bin/java, it can't be there!







      linux centos java redhat yum






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 6 '09 at 12:44









      RoryRory

      14.4k53145224




      14.4k53145224




















          7 Answers
          7






          active

          oldest

          votes


















          53














          Actually I found it,



          it's /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/. I found out what it was by doing update-alternatives --display java and it showed me the directory /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java






          share|improve this answer






























            20














            I'm not quite sure but if you install the normal RPMS the JAVA_HOME value can also be set to this:



            /usr/java/default/


            EDIT: I just checked on my home system. I have created this file:



            /etc/profile.d/java.sh


            That contains:



            export JAVA_HOME=/usr/java/default/


            and I'm using the official version from Sun: jdk-1.6.0_12-fcs



            EDIT: Here is how I set up Java on my machine:



            Install Java



            Download and install Java JDK from Oracle



            Make it primary



            Ensure this Java is used instead of the OpenJDK version using the following two commands:



            First



            alternatives --install /usr/bin/java java /usr/java/default/bin/java 999999 
            --slave /usr/bin/keytool keytool /usr/java/default/bin/keytool
            --slave /usr/bin/rmiregistry rmiregistry /usr/java/default/bin/rmiregistry


            Second



            alternatives --install /usr/bin/javac javac /usr/java/default/bin/javac 999999 
            --slave /usr/bin/jar jar /usr/java/default/bin/jar
            --slave /usr/bin/rmic rmic /usr/java/default/bin/rmic


            Set JAVA_HOME



            Ensure all users have their JAVA_HOME environment variable set to the correct value:



            echo "export JAVA_HOME=/usr/java/default/" > /etc/profile.d/java_home.sh





            share|improve this answer

























            • oh interesting. :)

              – Rory
              Aug 6 '09 at 13:19











            • There's no /usr/java/default in my CentOS 6 box with OpenJDK 1.6 and 1.7 installed.

              – Daniel Serodio
              Oct 28 '13 at 17:11











            • @DanielSerodio Correct. I clearly described "Download and install Java JDK from Oracle", and then it does exist.

              – Niels Basjes
              Oct 29 '13 at 9:06


















            2














            You want to set JAVA_HOME to be the root location of the JDK or JRE, for example:



            export JAVA_HOME=/usr/java/jdk1.3


            If the JDK (Development kit) is installed, ypu probably want it to point to that, else use the JRE path (Java Runtime Environment). Then, you might want to set your $PATH environment variable to include the bin directory as well:



            export PATH=$PATH:/usr/java/jdk1.3/bin


            If you are using tomcat, you might also need to set CATALINA_HOME for the tomcat user.



            export CATALINA_HOME=/path/to/tomcat


            To set this for the system you want to edit your /etc/profile or add a .sh file in /etc/profile.d folder. For a particular user you can put it in the users ~/.profile or ~/.bash_profile files.






            share|improve this answer























            • I wonder if there is a good reason the install doesn't do this for you if run as the super user, I always find it irritating ...

              – Kyle Brandt
              Aug 6 '09 at 13:15


















            2














            Below is always working for me perfectly:



            [user@base ~]$ locate bin/java
            /usr/bin/java
            /usr/bin/javac
            /usr/bin/javadoc
            /usr/bin/javaws
            /usr/java/jdk1.6.0_31/bin/java
            /usr/java/jdk1.6.0_31/bin/javac
            /usr/java/jdk1.6.0_31/bin/javadoc
            /usr/java/jdk1.6.0_31/bin/javah
            /usr/java/jdk1.6.0_31/bin/javap
            /usr/java/jdk1.6.0_31/bin/javaws
            /usr/java/jdk1.6.0_31/jre/bin/java
            /usr/java/jdk1.6.0_31/jre/bin/java_vm
            /usr/java/jdk1.6.0_31/jre/bin/javaws


            It means I can set JAVA_HOME as /usr/java/jdk1.6.0_31






            share|improve this answer
































              1














              I considered the problem of if one changes the version of java being used with:



              alternatives --config java


              Then any hard coded JAVA_HOME is going to change (atleast it will on the Centos 6.6 I'm currently staring at). That is, there is no /usr/java.



              This doesn't seem like the best way (open to failure) but in the 10 mins I've spent on this it seems the best.



              In /etc/bashrc I modified the setting to JAVA_HOME to be:



              export JAVA_HOME=$(alternatives --display java | grep current | sed 's/link currently points to //' | sed 's|/bin/java||')


              You have to do something similar on MacOSX but without all the grep and sed to parse out the result. Surely alternatives offers an similarly easier solution.



              Anyways I hope I helped.




              Update



              No that would be JRE_HOME. The JDK / SDK isn't proving as obvious (I'll keep looking).



              The alternatives seems to only be about the JRE by default. I defer to @Niels answer or just install Java with yum and set the JAVA_HOME to that (the trick is where I found where that was installed to!).



              yum install java-1.8.0-openjdk-devel.x86_64
              cd /usr/lib/jvm


              I noticed java_1.8.0 is a symlink to /etc/alternatives/java_sdk_1.8.0 and so set my $JAVA_HOME to /usr/lib/jvm/java_1.8.0. In the /etc/bashrc.






              share|improve this answer
































                0














                Thats weird, the whole point of having a JAVE_HOME environmental variable is so you don't have to specify the path to each program, it can get this path by looking for this variable.



                Either way, the correct way to find the environmental variable for JAVA_HOME is to use echo:



                [root@host ~]# echo $JAVA_HOME
                /usr/java/j2sdk1.4.2_09


                Running this command will display the path no matter what version you are running, from command line.






                share|improve this answer


















                • 2





                  The variable had not been set.

                  – Rory
                  Aug 6 '09 at 13:19


















                0














                re: Centos7, refer to the /etc/java/java.conf file.



                in it JAVA_HOME is indicated to be located in the following dir : /usr/lib/jvm/java



                i checked, it is the correct version of the jdk I loaded via yum, and so...



                my env doesn't have JAVA_HOME set by default, therefore I set it in .bash_profile






                share|improve this answer























                  Your Answer








                  StackExchange.ready(function()
                  var channelOptions =
                  tags: "".split(" "),
                  id: "2"
                  ;
                  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%2fserverfault.com%2fquestions%2f50883%2fwhat-is-the-value-of-java-home-for-centos%23new-answer', 'question_page');

                  );

                  Post as a guest















                  Required, but never shown

























                  7 Answers
                  7






                  active

                  oldest

                  votes








                  7 Answers
                  7






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  53














                  Actually I found it,



                  it's /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/. I found out what it was by doing update-alternatives --display java and it showed me the directory /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java






                  share|improve this answer



























                    53














                    Actually I found it,



                    it's /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/. I found out what it was by doing update-alternatives --display java and it showed me the directory /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java






                    share|improve this answer

























                      53












                      53








                      53







                      Actually I found it,



                      it's /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/. I found out what it was by doing update-alternatives --display java and it showed me the directory /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java






                      share|improve this answer













                      Actually I found it,



                      it's /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/. I found out what it was by doing update-alternatives --display java and it showed me the directory /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Aug 6 '09 at 12:49









                      RoryRory

                      14.4k53145224




                      14.4k53145224























                          20














                          I'm not quite sure but if you install the normal RPMS the JAVA_HOME value can also be set to this:



                          /usr/java/default/


                          EDIT: I just checked on my home system. I have created this file:



                          /etc/profile.d/java.sh


                          That contains:



                          export JAVA_HOME=/usr/java/default/


                          and I'm using the official version from Sun: jdk-1.6.0_12-fcs



                          EDIT: Here is how I set up Java on my machine:



                          Install Java



                          Download and install Java JDK from Oracle



                          Make it primary



                          Ensure this Java is used instead of the OpenJDK version using the following two commands:



                          First



                          alternatives --install /usr/bin/java java /usr/java/default/bin/java 999999 
                          --slave /usr/bin/keytool keytool /usr/java/default/bin/keytool
                          --slave /usr/bin/rmiregistry rmiregistry /usr/java/default/bin/rmiregistry


                          Second



                          alternatives --install /usr/bin/javac javac /usr/java/default/bin/javac 999999 
                          --slave /usr/bin/jar jar /usr/java/default/bin/jar
                          --slave /usr/bin/rmic rmic /usr/java/default/bin/rmic


                          Set JAVA_HOME



                          Ensure all users have their JAVA_HOME environment variable set to the correct value:



                          echo "export JAVA_HOME=/usr/java/default/" > /etc/profile.d/java_home.sh





                          share|improve this answer

























                          • oh interesting. :)

                            – Rory
                            Aug 6 '09 at 13:19











                          • There's no /usr/java/default in my CentOS 6 box with OpenJDK 1.6 and 1.7 installed.

                            – Daniel Serodio
                            Oct 28 '13 at 17:11











                          • @DanielSerodio Correct. I clearly described "Download and install Java JDK from Oracle", and then it does exist.

                            – Niels Basjes
                            Oct 29 '13 at 9:06















                          20














                          I'm not quite sure but if you install the normal RPMS the JAVA_HOME value can also be set to this:



                          /usr/java/default/


                          EDIT: I just checked on my home system. I have created this file:



                          /etc/profile.d/java.sh


                          That contains:



                          export JAVA_HOME=/usr/java/default/


                          and I'm using the official version from Sun: jdk-1.6.0_12-fcs



                          EDIT: Here is how I set up Java on my machine:



                          Install Java



                          Download and install Java JDK from Oracle



                          Make it primary



                          Ensure this Java is used instead of the OpenJDK version using the following two commands:



                          First



                          alternatives --install /usr/bin/java java /usr/java/default/bin/java 999999 
                          --slave /usr/bin/keytool keytool /usr/java/default/bin/keytool
                          --slave /usr/bin/rmiregistry rmiregistry /usr/java/default/bin/rmiregistry


                          Second



                          alternatives --install /usr/bin/javac javac /usr/java/default/bin/javac 999999 
                          --slave /usr/bin/jar jar /usr/java/default/bin/jar
                          --slave /usr/bin/rmic rmic /usr/java/default/bin/rmic


                          Set JAVA_HOME



                          Ensure all users have their JAVA_HOME environment variable set to the correct value:



                          echo "export JAVA_HOME=/usr/java/default/" > /etc/profile.d/java_home.sh





                          share|improve this answer

























                          • oh interesting. :)

                            – Rory
                            Aug 6 '09 at 13:19











                          • There's no /usr/java/default in my CentOS 6 box with OpenJDK 1.6 and 1.7 installed.

                            – Daniel Serodio
                            Oct 28 '13 at 17:11











                          • @DanielSerodio Correct. I clearly described "Download and install Java JDK from Oracle", and then it does exist.

                            – Niels Basjes
                            Oct 29 '13 at 9:06













                          20












                          20








                          20







                          I'm not quite sure but if you install the normal RPMS the JAVA_HOME value can also be set to this:



                          /usr/java/default/


                          EDIT: I just checked on my home system. I have created this file:



                          /etc/profile.d/java.sh


                          That contains:



                          export JAVA_HOME=/usr/java/default/


                          and I'm using the official version from Sun: jdk-1.6.0_12-fcs



                          EDIT: Here is how I set up Java on my machine:



                          Install Java



                          Download and install Java JDK from Oracle



                          Make it primary



                          Ensure this Java is used instead of the OpenJDK version using the following two commands:



                          First



                          alternatives --install /usr/bin/java java /usr/java/default/bin/java 999999 
                          --slave /usr/bin/keytool keytool /usr/java/default/bin/keytool
                          --slave /usr/bin/rmiregistry rmiregistry /usr/java/default/bin/rmiregistry


                          Second



                          alternatives --install /usr/bin/javac javac /usr/java/default/bin/javac 999999 
                          --slave /usr/bin/jar jar /usr/java/default/bin/jar
                          --slave /usr/bin/rmic rmic /usr/java/default/bin/rmic


                          Set JAVA_HOME



                          Ensure all users have their JAVA_HOME environment variable set to the correct value:



                          echo "export JAVA_HOME=/usr/java/default/" > /etc/profile.d/java_home.sh





                          share|improve this answer















                          I'm not quite sure but if you install the normal RPMS the JAVA_HOME value can also be set to this:



                          /usr/java/default/


                          EDIT: I just checked on my home system. I have created this file:



                          /etc/profile.d/java.sh


                          That contains:



                          export JAVA_HOME=/usr/java/default/


                          and I'm using the official version from Sun: jdk-1.6.0_12-fcs



                          EDIT: Here is how I set up Java on my machine:



                          Install Java



                          Download and install Java JDK from Oracle



                          Make it primary



                          Ensure this Java is used instead of the OpenJDK version using the following two commands:



                          First



                          alternatives --install /usr/bin/java java /usr/java/default/bin/java 999999 
                          --slave /usr/bin/keytool keytool /usr/java/default/bin/keytool
                          --slave /usr/bin/rmiregistry rmiregistry /usr/java/default/bin/rmiregistry


                          Second



                          alternatives --install /usr/bin/javac javac /usr/java/default/bin/javac 999999 
                          --slave /usr/bin/jar jar /usr/java/default/bin/jar
                          --slave /usr/bin/rmic rmic /usr/java/default/bin/rmic


                          Set JAVA_HOME



                          Ensure all users have their JAVA_HOME environment variable set to the correct value:



                          echo "export JAVA_HOME=/usr/java/default/" > /etc/profile.d/java_home.sh






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Dec 12 '17 at 0:24









                          Andrew

                          1033




                          1033










                          answered Aug 6 '09 at 13:16









                          Niels BasjesNiels Basjes

                          1,61431425




                          1,61431425












                          • oh interesting. :)

                            – Rory
                            Aug 6 '09 at 13:19











                          • There's no /usr/java/default in my CentOS 6 box with OpenJDK 1.6 and 1.7 installed.

                            – Daniel Serodio
                            Oct 28 '13 at 17:11











                          • @DanielSerodio Correct. I clearly described "Download and install Java JDK from Oracle", and then it does exist.

                            – Niels Basjes
                            Oct 29 '13 at 9:06

















                          • oh interesting. :)

                            – Rory
                            Aug 6 '09 at 13:19











                          • There's no /usr/java/default in my CentOS 6 box with OpenJDK 1.6 and 1.7 installed.

                            – Daniel Serodio
                            Oct 28 '13 at 17:11











                          • @DanielSerodio Correct. I clearly described "Download and install Java JDK from Oracle", and then it does exist.

                            – Niels Basjes
                            Oct 29 '13 at 9:06
















                          oh interesting. :)

                          – Rory
                          Aug 6 '09 at 13:19





                          oh interesting. :)

                          – Rory
                          Aug 6 '09 at 13:19













                          There's no /usr/java/default in my CentOS 6 box with OpenJDK 1.6 and 1.7 installed.

                          – Daniel Serodio
                          Oct 28 '13 at 17:11





                          There's no /usr/java/default in my CentOS 6 box with OpenJDK 1.6 and 1.7 installed.

                          – Daniel Serodio
                          Oct 28 '13 at 17:11













                          @DanielSerodio Correct. I clearly described "Download and install Java JDK from Oracle", and then it does exist.

                          – Niels Basjes
                          Oct 29 '13 at 9:06





                          @DanielSerodio Correct. I clearly described "Download and install Java JDK from Oracle", and then it does exist.

                          – Niels Basjes
                          Oct 29 '13 at 9:06











                          2














                          You want to set JAVA_HOME to be the root location of the JDK or JRE, for example:



                          export JAVA_HOME=/usr/java/jdk1.3


                          If the JDK (Development kit) is installed, ypu probably want it to point to that, else use the JRE path (Java Runtime Environment). Then, you might want to set your $PATH environment variable to include the bin directory as well:



                          export PATH=$PATH:/usr/java/jdk1.3/bin


                          If you are using tomcat, you might also need to set CATALINA_HOME for the tomcat user.



                          export CATALINA_HOME=/path/to/tomcat


                          To set this for the system you want to edit your /etc/profile or add a .sh file in /etc/profile.d folder. For a particular user you can put it in the users ~/.profile or ~/.bash_profile files.






                          share|improve this answer























                          • I wonder if there is a good reason the install doesn't do this for you if run as the super user, I always find it irritating ...

                            – Kyle Brandt
                            Aug 6 '09 at 13:15















                          2














                          You want to set JAVA_HOME to be the root location of the JDK or JRE, for example:



                          export JAVA_HOME=/usr/java/jdk1.3


                          If the JDK (Development kit) is installed, ypu probably want it to point to that, else use the JRE path (Java Runtime Environment). Then, you might want to set your $PATH environment variable to include the bin directory as well:



                          export PATH=$PATH:/usr/java/jdk1.3/bin


                          If you are using tomcat, you might also need to set CATALINA_HOME for the tomcat user.



                          export CATALINA_HOME=/path/to/tomcat


                          To set this for the system you want to edit your /etc/profile or add a .sh file in /etc/profile.d folder. For a particular user you can put it in the users ~/.profile or ~/.bash_profile files.






                          share|improve this answer























                          • I wonder if there is a good reason the install doesn't do this for you if run as the super user, I always find it irritating ...

                            – Kyle Brandt
                            Aug 6 '09 at 13:15













                          2












                          2








                          2







                          You want to set JAVA_HOME to be the root location of the JDK or JRE, for example:



                          export JAVA_HOME=/usr/java/jdk1.3


                          If the JDK (Development kit) is installed, ypu probably want it to point to that, else use the JRE path (Java Runtime Environment). Then, you might want to set your $PATH environment variable to include the bin directory as well:



                          export PATH=$PATH:/usr/java/jdk1.3/bin


                          If you are using tomcat, you might also need to set CATALINA_HOME for the tomcat user.



                          export CATALINA_HOME=/path/to/tomcat


                          To set this for the system you want to edit your /etc/profile or add a .sh file in /etc/profile.d folder. For a particular user you can put it in the users ~/.profile or ~/.bash_profile files.






                          share|improve this answer













                          You want to set JAVA_HOME to be the root location of the JDK or JRE, for example:



                          export JAVA_HOME=/usr/java/jdk1.3


                          If the JDK (Development kit) is installed, ypu probably want it to point to that, else use the JRE path (Java Runtime Environment). Then, you might want to set your $PATH environment variable to include the bin directory as well:



                          export PATH=$PATH:/usr/java/jdk1.3/bin


                          If you are using tomcat, you might also need to set CATALINA_HOME for the tomcat user.



                          export CATALINA_HOME=/path/to/tomcat


                          To set this for the system you want to edit your /etc/profile or add a .sh file in /etc/profile.d folder. For a particular user you can put it in the users ~/.profile or ~/.bash_profile files.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Aug 6 '09 at 13:12









                          Kyle BrandtKyle Brandt

                          66.4k61263414




                          66.4k61263414












                          • I wonder if there is a good reason the install doesn't do this for you if run as the super user, I always find it irritating ...

                            – Kyle Brandt
                            Aug 6 '09 at 13:15

















                          • I wonder if there is a good reason the install doesn't do this for you if run as the super user, I always find it irritating ...

                            – Kyle Brandt
                            Aug 6 '09 at 13:15
















                          I wonder if there is a good reason the install doesn't do this for you if run as the super user, I always find it irritating ...

                          – Kyle Brandt
                          Aug 6 '09 at 13:15





                          I wonder if there is a good reason the install doesn't do this for you if run as the super user, I always find it irritating ...

                          – Kyle Brandt
                          Aug 6 '09 at 13:15











                          2














                          Below is always working for me perfectly:



                          [user@base ~]$ locate bin/java
                          /usr/bin/java
                          /usr/bin/javac
                          /usr/bin/javadoc
                          /usr/bin/javaws
                          /usr/java/jdk1.6.0_31/bin/java
                          /usr/java/jdk1.6.0_31/bin/javac
                          /usr/java/jdk1.6.0_31/bin/javadoc
                          /usr/java/jdk1.6.0_31/bin/javah
                          /usr/java/jdk1.6.0_31/bin/javap
                          /usr/java/jdk1.6.0_31/bin/javaws
                          /usr/java/jdk1.6.0_31/jre/bin/java
                          /usr/java/jdk1.6.0_31/jre/bin/java_vm
                          /usr/java/jdk1.6.0_31/jre/bin/javaws


                          It means I can set JAVA_HOME as /usr/java/jdk1.6.0_31






                          share|improve this answer





























                            2














                            Below is always working for me perfectly:



                            [user@base ~]$ locate bin/java
                            /usr/bin/java
                            /usr/bin/javac
                            /usr/bin/javadoc
                            /usr/bin/javaws
                            /usr/java/jdk1.6.0_31/bin/java
                            /usr/java/jdk1.6.0_31/bin/javac
                            /usr/java/jdk1.6.0_31/bin/javadoc
                            /usr/java/jdk1.6.0_31/bin/javah
                            /usr/java/jdk1.6.0_31/bin/javap
                            /usr/java/jdk1.6.0_31/bin/javaws
                            /usr/java/jdk1.6.0_31/jre/bin/java
                            /usr/java/jdk1.6.0_31/jre/bin/java_vm
                            /usr/java/jdk1.6.0_31/jre/bin/javaws


                            It means I can set JAVA_HOME as /usr/java/jdk1.6.0_31






                            share|improve this answer



























                              2












                              2








                              2







                              Below is always working for me perfectly:



                              [user@base ~]$ locate bin/java
                              /usr/bin/java
                              /usr/bin/javac
                              /usr/bin/javadoc
                              /usr/bin/javaws
                              /usr/java/jdk1.6.0_31/bin/java
                              /usr/java/jdk1.6.0_31/bin/javac
                              /usr/java/jdk1.6.0_31/bin/javadoc
                              /usr/java/jdk1.6.0_31/bin/javah
                              /usr/java/jdk1.6.0_31/bin/javap
                              /usr/java/jdk1.6.0_31/bin/javaws
                              /usr/java/jdk1.6.0_31/jre/bin/java
                              /usr/java/jdk1.6.0_31/jre/bin/java_vm
                              /usr/java/jdk1.6.0_31/jre/bin/javaws


                              It means I can set JAVA_HOME as /usr/java/jdk1.6.0_31






                              share|improve this answer















                              Below is always working for me perfectly:



                              [user@base ~]$ locate bin/java
                              /usr/bin/java
                              /usr/bin/javac
                              /usr/bin/javadoc
                              /usr/bin/javaws
                              /usr/java/jdk1.6.0_31/bin/java
                              /usr/java/jdk1.6.0_31/bin/javac
                              /usr/java/jdk1.6.0_31/bin/javadoc
                              /usr/java/jdk1.6.0_31/bin/javah
                              /usr/java/jdk1.6.0_31/bin/javap
                              /usr/java/jdk1.6.0_31/bin/javaws
                              /usr/java/jdk1.6.0_31/jre/bin/java
                              /usr/java/jdk1.6.0_31/jre/bin/java_vm
                              /usr/java/jdk1.6.0_31/jre/bin/javaws


                              It means I can set JAVA_HOME as /usr/java/jdk1.6.0_31







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited 2 days ago

























                              answered Jul 26 '14 at 17:14









                              prashantprashant

                              1213




                              1213





















                                  1














                                  I considered the problem of if one changes the version of java being used with:



                                  alternatives --config java


                                  Then any hard coded JAVA_HOME is going to change (atleast it will on the Centos 6.6 I'm currently staring at). That is, there is no /usr/java.



                                  This doesn't seem like the best way (open to failure) but in the 10 mins I've spent on this it seems the best.



                                  In /etc/bashrc I modified the setting to JAVA_HOME to be:



                                  export JAVA_HOME=$(alternatives --display java | grep current | sed 's/link currently points to //' | sed 's|/bin/java||')


                                  You have to do something similar on MacOSX but without all the grep and sed to parse out the result. Surely alternatives offers an similarly easier solution.



                                  Anyways I hope I helped.




                                  Update



                                  No that would be JRE_HOME. The JDK / SDK isn't proving as obvious (I'll keep looking).



                                  The alternatives seems to only be about the JRE by default. I defer to @Niels answer or just install Java with yum and set the JAVA_HOME to that (the trick is where I found where that was installed to!).



                                  yum install java-1.8.0-openjdk-devel.x86_64
                                  cd /usr/lib/jvm


                                  I noticed java_1.8.0 is a symlink to /etc/alternatives/java_sdk_1.8.0 and so set my $JAVA_HOME to /usr/lib/jvm/java_1.8.0. In the /etc/bashrc.






                                  share|improve this answer





























                                    1














                                    I considered the problem of if one changes the version of java being used with:



                                    alternatives --config java


                                    Then any hard coded JAVA_HOME is going to change (atleast it will on the Centos 6.6 I'm currently staring at). That is, there is no /usr/java.



                                    This doesn't seem like the best way (open to failure) but in the 10 mins I've spent on this it seems the best.



                                    In /etc/bashrc I modified the setting to JAVA_HOME to be:



                                    export JAVA_HOME=$(alternatives --display java | grep current | sed 's/link currently points to //' | sed 's|/bin/java||')


                                    You have to do something similar on MacOSX but without all the grep and sed to parse out the result. Surely alternatives offers an similarly easier solution.



                                    Anyways I hope I helped.




                                    Update



                                    No that would be JRE_HOME. The JDK / SDK isn't proving as obvious (I'll keep looking).



                                    The alternatives seems to only be about the JRE by default. I defer to @Niels answer or just install Java with yum and set the JAVA_HOME to that (the trick is where I found where that was installed to!).



                                    yum install java-1.8.0-openjdk-devel.x86_64
                                    cd /usr/lib/jvm


                                    I noticed java_1.8.0 is a symlink to /etc/alternatives/java_sdk_1.8.0 and so set my $JAVA_HOME to /usr/lib/jvm/java_1.8.0. In the /etc/bashrc.






                                    share|improve this answer



























                                      1












                                      1








                                      1







                                      I considered the problem of if one changes the version of java being used with:



                                      alternatives --config java


                                      Then any hard coded JAVA_HOME is going to change (atleast it will on the Centos 6.6 I'm currently staring at). That is, there is no /usr/java.



                                      This doesn't seem like the best way (open to failure) but in the 10 mins I've spent on this it seems the best.



                                      In /etc/bashrc I modified the setting to JAVA_HOME to be:



                                      export JAVA_HOME=$(alternatives --display java | grep current | sed 's/link currently points to //' | sed 's|/bin/java||')


                                      You have to do something similar on MacOSX but without all the grep and sed to parse out the result. Surely alternatives offers an similarly easier solution.



                                      Anyways I hope I helped.




                                      Update



                                      No that would be JRE_HOME. The JDK / SDK isn't proving as obvious (I'll keep looking).



                                      The alternatives seems to only be about the JRE by default. I defer to @Niels answer or just install Java with yum and set the JAVA_HOME to that (the trick is where I found where that was installed to!).



                                      yum install java-1.8.0-openjdk-devel.x86_64
                                      cd /usr/lib/jvm


                                      I noticed java_1.8.0 is a symlink to /etc/alternatives/java_sdk_1.8.0 and so set my $JAVA_HOME to /usr/lib/jvm/java_1.8.0. In the /etc/bashrc.






                                      share|improve this answer















                                      I considered the problem of if one changes the version of java being used with:



                                      alternatives --config java


                                      Then any hard coded JAVA_HOME is going to change (atleast it will on the Centos 6.6 I'm currently staring at). That is, there is no /usr/java.



                                      This doesn't seem like the best way (open to failure) but in the 10 mins I've spent on this it seems the best.



                                      In /etc/bashrc I modified the setting to JAVA_HOME to be:



                                      export JAVA_HOME=$(alternatives --display java | grep current | sed 's/link currently points to //' | sed 's|/bin/java||')


                                      You have to do something similar on MacOSX but without all the grep and sed to parse out the result. Surely alternatives offers an similarly easier solution.



                                      Anyways I hope I helped.




                                      Update



                                      No that would be JRE_HOME. The JDK / SDK isn't proving as obvious (I'll keep looking).



                                      The alternatives seems to only be about the JRE by default. I defer to @Niels answer or just install Java with yum and set the JAVA_HOME to that (the trick is where I found where that was installed to!).



                                      yum install java-1.8.0-openjdk-devel.x86_64
                                      cd /usr/lib/jvm


                                      I noticed java_1.8.0 is a symlink to /etc/alternatives/java_sdk_1.8.0 and so set my $JAVA_HOME to /usr/lib/jvm/java_1.8.0. In the /etc/bashrc.







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Jun 23 '15 at 3:55

























                                      answered Jun 23 '15 at 3:24









                                      HankCaHankCa

                                      1415




                                      1415





















                                          0














                                          Thats weird, the whole point of having a JAVE_HOME environmental variable is so you don't have to specify the path to each program, it can get this path by looking for this variable.



                                          Either way, the correct way to find the environmental variable for JAVA_HOME is to use echo:



                                          [root@host ~]# echo $JAVA_HOME
                                          /usr/java/j2sdk1.4.2_09


                                          Running this command will display the path no matter what version you are running, from command line.






                                          share|improve this answer


















                                          • 2





                                            The variable had not been set.

                                            – Rory
                                            Aug 6 '09 at 13:19















                                          0














                                          Thats weird, the whole point of having a JAVE_HOME environmental variable is so you don't have to specify the path to each program, it can get this path by looking for this variable.



                                          Either way, the correct way to find the environmental variable for JAVA_HOME is to use echo:



                                          [root@host ~]# echo $JAVA_HOME
                                          /usr/java/j2sdk1.4.2_09


                                          Running this command will display the path no matter what version you are running, from command line.






                                          share|improve this answer


















                                          • 2





                                            The variable had not been set.

                                            – Rory
                                            Aug 6 '09 at 13:19













                                          0












                                          0








                                          0







                                          Thats weird, the whole point of having a JAVE_HOME environmental variable is so you don't have to specify the path to each program, it can get this path by looking for this variable.



                                          Either way, the correct way to find the environmental variable for JAVA_HOME is to use echo:



                                          [root@host ~]# echo $JAVA_HOME
                                          /usr/java/j2sdk1.4.2_09


                                          Running this command will display the path no matter what version you are running, from command line.






                                          share|improve this answer













                                          Thats weird, the whole point of having a JAVE_HOME environmental variable is so you don't have to specify the path to each program, it can get this path by looking for this variable.



                                          Either way, the correct way to find the environmental variable for JAVA_HOME is to use echo:



                                          [root@host ~]# echo $JAVA_HOME
                                          /usr/java/j2sdk1.4.2_09


                                          Running this command will display the path no matter what version you are running, from command line.







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Aug 6 '09 at 12:56









                                          Dave DragerDave Drager

                                          7,8202142




                                          7,8202142







                                          • 2





                                            The variable had not been set.

                                            – Rory
                                            Aug 6 '09 at 13:19












                                          • 2





                                            The variable had not been set.

                                            – Rory
                                            Aug 6 '09 at 13:19







                                          2




                                          2





                                          The variable had not been set.

                                          – Rory
                                          Aug 6 '09 at 13:19





                                          The variable had not been set.

                                          – Rory
                                          Aug 6 '09 at 13:19











                                          0














                                          re: Centos7, refer to the /etc/java/java.conf file.



                                          in it JAVA_HOME is indicated to be located in the following dir : /usr/lib/jvm/java



                                          i checked, it is the correct version of the jdk I loaded via yum, and so...



                                          my env doesn't have JAVA_HOME set by default, therefore I set it in .bash_profile






                                          share|improve this answer



























                                            0














                                            re: Centos7, refer to the /etc/java/java.conf file.



                                            in it JAVA_HOME is indicated to be located in the following dir : /usr/lib/jvm/java



                                            i checked, it is the correct version of the jdk I loaded via yum, and so...



                                            my env doesn't have JAVA_HOME set by default, therefore I set it in .bash_profile






                                            share|improve this answer

























                                              0












                                              0








                                              0







                                              re: Centos7, refer to the /etc/java/java.conf file.



                                              in it JAVA_HOME is indicated to be located in the following dir : /usr/lib/jvm/java



                                              i checked, it is the correct version of the jdk I loaded via yum, and so...



                                              my env doesn't have JAVA_HOME set by default, therefore I set it in .bash_profile






                                              share|improve this answer













                                              re: Centos7, refer to the /etc/java/java.conf file.



                                              in it JAVA_HOME is indicated to be located in the following dir : /usr/lib/jvm/java



                                              i checked, it is the correct version of the jdk I loaded via yum, and so...



                                              my env doesn't have JAVA_HOME set by default, therefore I set it in .bash_profile







                                              share|improve this answer












                                              share|improve this answer



                                              share|improve this answer










                                              answered Mar 7 at 18:29









                                              theRileytheRiley

                                              1012




                                              1012



























                                                  draft saved

                                                  draft discarded
















































                                                  Thanks for contributing an answer to Server Fault!


                                                  • 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%2fserverfault.com%2fquestions%2f50883%2fwhat-is-the-value-of-java-home-for-centos%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

                                                  Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

                                                  Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

                                                  Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020