How to uninstall your own JDK and install the desired JDK under Linuxafter installing the Linux system, the system has its own JDK version, because some of the software in the system needs to use this environment. But when we install Eclipse and Tomcat, it's not possible to use this JDK. At this point we need to install our own downloaded JDK, but before that we need to uninstall the JDK that comes with the system.Tools/Materials
- centos6.x This version of the Linux system
- JDK, download URL: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html, select the version you need to download
- The following installation is shown in RPM package, so please download the rpm package file.
Method/Step
- 1
First Look at the Java version of the system:java-version; then use:rpm-qa | gcj command to view specific information, and finally use:rpm-e--nodeps java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64 Uninstall.
- 2
Drag the download RPM package into the Linux system and proceed to the appropriate directory:RPM-IVH jdk-7u51-linux-x64.rpm
- 3
after installation, configure the environment variable: Execute the vi/etc/profile command to add the configuration information such as. Note: The directory to write your own installation directory, the general default is installed under the/usr/java. java_home=/usr/java/jdk1.7.0_45Tomcat_home=/home/syx/server/tomcatpath= $JAVA _home/bin: $PATHclasspath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jarExport Java_homeExport Tomcat_homeExport PATHExport CLASSPATH
- 4
If you do not want to re-system, you can use the command source/etc/profile to make the configuration file effective immediately. Otherwise, the system can only be restarted for the configuration parameters to take effect. We can then use echo $JAVA _home; echo $PATH; echo $CLASSPATHto view the configuration information.
- 5
Finally we pass:java-version See if we have successfully installed the JDK.
How to uninstall your own JDK and install the desired JDK under Linux