Because we need to compile 2.1 and 2.3 copies in the same Ubuntu EnvironmentCodeAnd the Java version they use is 1.5, and the other is 1.6, so you need to switch before compiling;
The switchover method is simple. Use the following two commands:
Update-alternatives -- config Java
Update-alternatives -- config javac
For example:
Root @ desktop-Ubuntu :~ # Update-alternatives -- config Java
There are 2 choices for the alternative Java (providing/usr/bin/Java ).
Select the path priority status
------------------------------------------------------------
* 0/usr/lib/JVM/Java-6-sun/JRE/bin/Java 63 automatic mode
1/usr/lib/JVM/Java-1.5.0-sun/JRE/bin/Java 53 manual mode
2/usr/lib/JVM/Java-6-sun/JRE/bin/Java 63 manual mode
To maintain the current value [*], press the Enter key or enter the selected number: 1.
Update-Alternatives:/usr/lib/JVM/Java-1.5.0-sun/JRE/bin/Java is used to provide/usr/bin/Java (Java) in manual mode.
You only need to enter the desired number and press Enter. If you do not change the number, press enter directly. Do not forget to change the value of javac ~
After modification,
Java-version
Javac-version to confirm ~