Ubuntu12.04 after JDK is installed, the default JDK 1.6 installation is available. How can I install JDK 1.7.x?
I tried it.Code:
The original installation path is:/home/xwh/desktop/environment/jdk1.7.0 _ 07. Later, I found that it is not feasible. I can only conceal the online code and first get the JDK directory to a fixed path, in fact, JDK installed by default is here
MV/home/xwh/desktop/environment/jdk1.7.0 _ 07/usr/lib/JVM
The purpose is to rename the folder.
MV/usr/lib/JVM/jdk1.7.0 _ 07/usr/lib/JVM/Java-7-sun
Then change the Java and javac paths.
Update-alternatives -- install/usr/bin/Java/usr/lib/JVM/Java-7-sun/bin/Java 300
Update-alternatives -- install/usr/bin/javac Java/usr/lib/JVM/Java-7-sun/bin/javac 300
Then change the path
Update-alternatives -- config Java
There are two candidates for the effect to replace Java (/usr/bin/Java ).
Select the path priority status
------------------------------------------------------------
* 0/usr/lib/JVM/java-6-openjdk-amd64/JRE/bin/Java 1061 automatic mode
1/usr/lib/JVM/java-6-openjdk-amd64/JRE/bin/Java 1061 manual mode
2/usr/lib/JVM/Java-7-sun/bin/Java 300 manual mode
To maintain the current value [*], press the Enter key or enter the selected number:
Enter the number.