Get ready
In general, we will have to uninstall the Linux openjdk, and then install the Sun's JDK.
First, uninstall your own Java
Check to see if the Linux-brought JDK is installed.
Enter the following command to view the installed Java version information.
java -version
Enter the following command to view the information for the JDK.
rpm -qa|grep java
As shown in.
Uninstall the already installed Java, as shown in.
The uninstallation is complete as shown in.
Uninstall the other one, as shown in.
The uninstallation is complete as shown in.
The second step is to install the sun's JDK.
Official website: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Create a Java directory under/usr in case the Java program is installed in this directory, enter the following command:
mkdir
Copy the downloaded installation file to the original system's shared folder share, and view the file by command:
cd /mnt/share -a
Copy the file to the/usr/java directory and enter the following command:
cp *.gz /usr/java
To view the/usr/java directory, enter the following command:
cd /usr/java -a
Unzip the file and enter the following command:
Linux Code
-xzvf jdk-7u13-linux-x64.gz
After decompression, in the/usr/java directory will generate a new directory jdk1.7.0_13, which is stored in the extracted files.
For later setup convenience, we have renamed the directory jdk1.7.0_13 to JDK, enter the following command:
mv jdk1.7.0_13 jdk
Or, if the file you downloaded is in RPM format, replace it with the following command at the tar command above, and the other steps will be the same.
-ivh jdk-7u13-linux-x64.
Finally, the environment variable is set.
Enter the configuration file by entering the following command, or open the configuration file by other means.
vi /etc/profile
Enter the configuration file, as shown in, and delete the following line 1th, changing to the following 2-4 lines of configuration information.
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROLexport JAVA_HOME=/usr/local/jdk1.7.0_79export PATH=$JAVA_HOME/bin:$PATHexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
Let the environment variable take effect.
Execute the configuration file so that it takes effect immediately and enter the following command:
source /etc/profile
To verify that the installation was successful, enter the following command:
Java -version
"Linux Advanced" CentOS installation Java environment