By default, even with Java 1.6 version Java script jdk-6u31-linux-i586.bin, when Java is installed, it will automatically upgrade to a 1.7 version state. For some applications that need to be run based on version 1.6, a downgrade of 1.6 is required. There are two specific ways to do this:
1. Use the alternatives command to implement.
Alternatives is a powerful command under Linux, and can only be executed under root authority. If there are several command functions in the system that are very similar, but can not be arbitrarily deleted, then use alternatives to specify a global setting.
[Email protected] ~]# alternatives
Alternatives version 1.3.49.3-copyright (C) 2001 Red Hat, Inc.
This is freely redistributed under the terms of the GNU public License.
Usage:alternatives--install <link> <name> <path> <priority>
[--initscript <service>]
[--slave <link> <name> <path>]*
Alternatives--remove <name> <path>
Alternatives--auto <name>
Alternatives--config <name>
Alternatives--display <name>
Alternatives--set <name> <path>
Common options:--verbose--test--help--usage--version
--altdir <directory>--admindir <directory>
You can see the relevant command information for the corresponding alternatives.
Description
Alternatives--install <link> <name> <path> <priority>
which
Install indicates installation
Link is a symbolic link
Name is the identifier
Path is the way to execute the file
Priority indicates precedence
In the current state, I need to modify the Java version, the specific operation is shown as follows:
A. Run alternatives--config Java in root, as shown below:
[Email protected] ~]#Alternatives--config Java
There is 2 programs which provide ' Java '.
Selection Command
-----------------------------------------------
*+ 1/usr/lib/jvm/jre-1.7.0-openjdk/bin/java
2/usr/lib/jvm/jre-1.6.0-openjdk/bin/java
Enter to keep the current selection[+], or type selection number:2
B. Then select the option that you want to use for your version number. "2"
C. Re-run Java-version
See is the current choice of Java version 1.6.
2. Use the installation modification method. This is a somewhat unusual way to run before the first method can be retained and selected, more appropriate.
The 1.7 version of Java is already installed and requires the following actions:
chmod +x Jdk-6u32-linux-i586.bin
Install version 1.6
./jdk-6u32-linux-i586.bin
MV jdk1.6.0_32//usr/java
Cd/usr/java
RM-FR Latest
Ln-s Jdk1.6.0_32/latest
Then modify the Java path information inside the/etc/profle.
After completing the profile modification, Source/etc/pofile
Java-version can see that the version has also been downgraded.
#JAVA_HOME =/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.45.x86_64/
#JAVA_BIN =/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.45.x86_64/bin
Java_home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-1.b15.el6_7.x86_64/jre/
java_bin=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-1.b15.el6_7.x86_64/jre/bin/
Path= $PATH: $JAVA _bin
Change the Java version alternatives under Linux