Like me.now there's a 1.7 version of what to do if you want to install version 1.6?
0. You can try it first, 1.7, 1.6 will be able to install. Because I use Ubuntu system, install jdk,jdk-6u45-linux-x64.bin,jdk-7u71-linux-x64.tar.gz can install. 1.7 version of the direct decompression (TAR-ZXVF jdk-7u71-linux-x64.tar.gz), 1.6 version directly with./jdk-6u45-linux-x64.bin execution, can be installed.
After installation, there is a 1.7 directory and 1.6 directory, and then establish a soft connection ln-s jdk1.7.0_71/usr/java/default (in the directory/ Usr/java, establish the soft connection default, point to the jdk1.7.0_71 directory under the current folder , if you need to use version 1.6, just point the soft connection to 1.6), write the environment variable to the file java.sh,
Java_home=/usr/java/default
Java_bin=/usr/java/default/bin
Path= $PATH: $JAVA _home/bin
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export Java_home java_bin PATH CLASSPATH
Export grub_distributor= "Neuos"
Then put the java.sh file below the path/etc/profile.d/and you can use it.
1. Uninstall version 1.7, because 1.7 version 1.6 is not installed.
# Rpm-qa |grep JDK queries the currently installed JDK
Show me the content, I'm currently installing 1.7
# jdk-1.7.0_71-fcs.x86_64
# rpm-e jdk-1.7.0_71-fcs.x86_64 Uninstall JDK
2. Download the package, upload to Linux, my two packages, a 1.6 a 1.7 version, Jdk-6u35-linux-x64-rpm.bin, jdk-7u71-linux-x64.rpm
3. Installation 1.6
The bin file can be executed directly
#./jdk-6u35-linux-x64-rpm.bin
Execute java-version command after execution, display Java version "1.6.0_35", this time 1.6 installs successfully!
4. Installation 1.7
My 1.7 of the package is RPM package, this time to note, to use the command # RPM-IVH jdk-7u71-linux-x64.rpm, do not use # RPM-UVH jdk-7u71-linux-x64.rpm
Because-UVH is an upgrade installation, will cover 1.6 off, in the installation of 1.7, it became the result of the previous article, we are now the purpose is to install two versions of the JDK, so use-IVH
Specifically, you can check the difference between-UVH and-IVH.
# RPM-IVH jdk-7u71-linux-x64.rpm
But there will be an error, version conflict.
File/etc/init.d/jexec from install of jdk-2000:1.7.0_71-fcs.x86_64 conflicts with file from package JDK-2000:1.6.0_35-FC S.x86_64
This time to add parameters --force--Nodeps
# rpm -ivh -- Force--nodeps jdk-7u71-linux-x64.rpm
At this time in the view file, there are two folders, jdk1.6.0_35 and jdk1.7.0_71, there is a soft connection default, if you need to change the JDK version, just change the point of the soft connection.
Java-version is version 1.7, dual version installed successfully!
5. Eclipse Select version
Eclipse's current version 1.7, we're going to add the jdk1.6 version.
Window-"Preferences-" Java-"Installed JREs-" ADD-"standard VM
JRE Home Select the path you just installed, and the JRE name will usually automatically write the version in, ok!
At this time we have two versions in eclipse to choose from!
When we need to select the JDK version, the project right button-"Preferences-" Click on the Libraries tab-"ADD Library-" JRE System Library-"Click Alternate JRE, You can choose one of the two versions we've installed!
Here's the difference between the Alternate JRE and the execution environment: the Alternate JRE is our own installation, execution environment is the eclipse comes with, here we install the
Install two versions of the JDK also note the three selected version of the place, select the version to be consistent : Buildpath,java compiler,project Facets
< Span style= "Box-sizing:border-box; margin:0px; padding:0px; font-size:14px; line-height:26px; " > If the project error can be found in these three places whether the selected version is inconsistent.
< Span style= "Box-sizing:border-box; margin:0px; padding:0px; font-size:14px; line-height:26px; " > for
Project Facets, right-click Projects, find Java, tap the drop-down list below, select the desired version, OK
Linux Install dual version jdk (2) RPM-IVH OR-UVH?