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!
Actually I found it,
I'm not quite sure but if you install the normal RPMS the JAVA_HOME value can also be set to this:
EDIT: I just checked on my home system. I have created this file:
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:
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:
Ensure all users have their JAVA_HOME environment variable set to the correct value:
You want to set JAVA_HOME to be the root location of the JDK or JRE, for example:
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:
If you are using tomcat, you might also need to set CATALINA_HOME for the tomcat user.
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.
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:
Running this command will display the path no matter what version you are running, from command line.
Below is always working form me perfectly:
It means I can set JAVA_HOME as /usr/java/jdk1.6.0_31