Install jdk on RedHatLinux or Ubuntu. The most important thing is to set environment variables. In RedHatLinux, the environment variables set in/etc/profiles are visible to all users. The second is in the HOME directory of each user. bash_profiles. The configuration information in this file is the environment variable information unique to each user. After the system starts, it first loads the environment variable information in/etc/profiles. After logging on to a specific system, load the user
Install jdk on Red Hat Linux or Ubuntu. The most important thing is the setting of environment variables. In Red Hat Linux, the environment variables set in/etc/profiles are visible to all users. The second is in the HOME directory of each user. bash_profiles. The configuration information in this file is the environment variable information unique to each user. After the system starts, it first loads the environment variable information in/etc/profiles. After logging on to a specific system, load. the environment variable information in the bash_profiles file. If an environment variable such as JAVA_HOME =/usr/java/jdk is defined in/etc/profiles. bash_profiles defines JAVA_HOME =/opt/java/jdk. so some people will ask what the JAVA_HOME value is? If the su-username you are using is switched to this user, the JAVA_HOME value is the value in. bash_profiles. That is to say, the variable value in. bash_profiles will replace the value of the same variable in/etc/profiles. Different parts will be inherited directly.
Reading:
Install JDK 7 (with Clojure download) http://www.linuxidc.com/Linux/2012-10/71557.htm under Ubuntu
Install JDK1.7 http://www.linuxidc.com/Linux/2012-06/62239.htm in Ubuntu 12.04
Let's talk about the jdk environment configuration. First, we recommend that you configure the JAVA environment variable value in your. bash_profiles file. For example, switch to a user or directly use the root user configuration. (Take the user hzw as an example. The following red part indicates the jdk installation path );
# Su-hzw
# Cat> ~ /. Bash_profiles < < p><>
Export JAVA_HOME =/usr/java/jdk_1.6
Export PATH = \ $ PATH: \ $ JAVA_HOME/bin
Export CLASSPATH =\$ CLASSPATH: \ $ JAVA_HOME \ lib: \ $ JAVA_HOME/lib/dt. jar: \ $ JAVA_HOME \ lib \ tools. jar
EOF
If multiple jdk versions are installed on the machine, further configuration is required. For example, if you enter
# Java-version
This command does not display the jdk version information you want. Execute the following command (the red part below indicates the jdk version installation directory you want ):
# Su-root
# Export JAVA_HOME =/usr/java/jdk_1.6
# Update-alternatives -- install/usr/bin/java $ JAVA_HOME/bin/java 300
# Update-alternatives -- install/usr/bin/javac $ JAVA_HOME/bin/javac 300
Then, run the following two commands and select the jdk version you want.
# Update-alternatives -- config java
# Update-alternatives -- config javac
Then execute
# Java-version
Check whether it is the jdk version you want.
For more information about RedHat, see RedHat topic page http://www.linuxidc.com/topicnews.aspx? Tid = 10