Ubuntu11.04 the built-in Java environment of the system is openjdk. it is best to use sunjdk. the specific reason is unknown. the online tutorials are basically like this: Ubuntu1. install the Java environment that comes with JDK ubuntu 11.04 is openjdk, it is best to use sunjdk (the specific reason is unknown, the online tutorials are basically like this), so go to the official website (http://www.oracle.com/technetwork/java/javase/downloads/index.html) to download the JDK installation package "Java SE 6 Update 26: linux x86-Self Extracting Installer (81.20 MB) jdk-6u26-linux-i586.bin
1.1. after downloading the SDK, start to install JDK. enter the following in the terminal:
Copy codeThe code is as follows:
Cd Downloads/
Sudo cp co jdk-6u26-linux-i586.bin/opt
Cd/opt
Sudo chmod + x jdk-6u26-linux-i586.bin
1.2. decompress the installation package for installation.
Copy codeThe code is as follows:
Sudo./jdk-6u26-linux-i586.bin
1.3. configure the environment variable and modify the profile file.
Copy codeThe code is as follows:
Sudo gedit/etc/profile
Add the following code in the text:
Copy codeThe code is as follows:
# Sun JDK profile
Export JAVA_HOME =/opt/jdk1.6.0 _ 26
Export JRE_HOME =/opt/jdk1.6.0 _ 26/jre
Export CLASSPATH =.: $ CLASSPATH: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib
Export PATH = $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH: $ HOME/bin
1.4. modify another file, environment:
Copy codeThe code is as follows:
Sudo gedit/etc/environment
Add the following code in the text:
Copy codeThe code is as follows:
# Sun JDK environment
Export JAVA_HOME =/opt/jdk1.6.0 _ 26
Export JRE_Home =/opt/jdk1.6.0 _ 26/jre
Export CLASSPATH =.: $ CLASSPATH: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib
1.5. manually configure JDK.
Copy codeThe code is as follows:
Sudo update-alternatives -- install/usr/bin/java/opt/jdk1.6.0 _ 26/bin/java 300
Sudo update-alternatives -- install/usr/bin/javac/opt/jdk1.6.0 _ 26/bin/javac 300
1.6. let the system use our installed JDK.
Copy codeThe code is as follows:
Sudo update-alternatives -- config java
1.7. verify that JDK is successfully installed.
Copy codeThe code is as follows:
Java-version
The following information is displayed.
Copy codeThe code is as follows:
Java version "1.6.0 _ 26"
Java (TM) SE Runtime Environment (build 1.6.0 _ 26-b03)
Java HotSpot (TM) Server VM (build between 1-b02, mixed mode)
2. install Eclipse.
2.1. first extract the downloaded compressed package and enter:
Copy codeThe code is as follows:
Tar-zxvf eclipse-SDK-3.6.2-linux-gtk.tar.gz
Sudo mv eclipse/opt/
Sudo gedit/usr/share/applications/Eclipse. desktop
Fill in the text:
Copy codeThe code is as follows:
[Desktop Entry]
Name = Eclipse
Comment = Eclipse IDE
Exec =/opt/eclipse
Icon =/opt/eclipse/icon. xpm
Terminal = false
Type = Application
Categories = Application; Development;
2.2 eclipse installation is complete.