Ubuntu11.04 comes with the default OpenJDK. Although many articles on the Internet say that OpenJDK is no different from Sun's JDK, use the official JDK just in case. Step 1, install Sun's JDK: sudoapt-getinstallsun-java6-jresudoapt-getinstallsun-java6-jdk at this time, enter java-version in the command line, the JDK is still OpenJ
Ubuntu 11.04 comes with the default OpenJDK. Although many articles on the Internet say that OpenJDK is no different from Sun's JDK, use the official JDK just in case.
Step 1: Install Sun's JDK:
Sudo apt-get install sun-java6-jre
Sudo apt-get install sun-java6-jdk
In this case, enter java-version in the command line, and the displayed JDK is still OpenJDK. Therefore, you need to modify the default JDK.
Step 2: Modify the default JDK
Sudo update-alternatives -- config java
In this case, the command line prompts you to select the appropriate JDK, as shown in figure
There are 2 choices for the alternative java (providing/usr/bin/java ).
Selection Path Priority Status
------------------------------------------------------------
* 0/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2/usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode
Press enter to keep the current choice [*], or type selection number: 2
After selecting java-6-sun and entering java-version, Sun's JDK information will be displayed.