Install JDK 6 first
Sudo apt-Get install sun-java6-jdk
Then you need to set the default JavaProgram
Sudo Update-alternatives -- config Java
Enter the corresponding options as prompted, and set them to JDK 6.
The following settings
Sudo Vim/etc/environment
Add the following two lines:
Classpath =/usr/lib/JVM/Java-6-sun/lib
Java_home =/usr/lib/JVM/Java-6-sun
If classpath and java_home are already set, change them to the above format and press ZZ to save and exit.
Next install eclipse
Sudo apt-Get install eclipse
Note that eclipse does not care about the update-alternative
Therefore, you should modify the eclipse configuration. First, set the SUN-JDK-6 to the system default:
Sudo Update-Java-alternatives-s Java-6-sun
Then edit the JVM configuration file:
Sudo Vim/etc/JVM
Add
/Usr/lib/JVM/Java-6-sun
(If not, create it by yourself)
Sudo Vim/etc/Eclipse/java_home
Also add at the top of the file
/Usr/lib/JVM/Java-6-sun
Start eclipse, select help-> about eclipse SDK, and select configuration details. You can see that jdk6 settings have taken effect.