First, go to the official website to download the Linux version of the JDK and the Eclipse tar package and unzip it. I packets the JDK under the/usr/java/directory, and Eclipse is in the/opt/directory.
Then, configure the Java development environment, which is to install the JDK:
1, configuration environment variables, change/etc/profile file: sudo gedit/etc/profile;
At the end of the file add the following lines (in fact, the same as the configuration principle under Windows, but the expression is different):
Export Java_home=/usr/java/jdk1.7.0_04
Export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH
Export classpath= $CLASSPATH:.: $JAVA _home/lib: $JAVA _home/jre/lib
2. Change the default configuration option and execute the following command sequentially
sudo update-alternatives--install/usr/bin/java Java/usr/java/jdk1.7.0_04/bin/java 300
sudo update-alternatives--install/usr/bin/jar Jar/usr/java/jdk1.7.0_04/bin/jar 300
sudo update-alternatives--install/usr/bin/javah javah/usr/java/jdk1.7.0_04/bin/javah 300
sudo update-alternatives--install/usr/bin/javap JAVAP/USR/JAVA/JDK1.7.0_04/BIN/JAVAP 300
3. Test Run Java-version
The installation succeeds as follows:
Java Version "1.7.0_07"
Java (TM) SE Runtime Environment (build 1.7.0_07-B10)
Java HotSpot (TM) Server VM (build 23.3-b01, Mixed mode)
Finally, configure eclipse (the following)
sudo gedit /usr/share/applications/eclipse.desktop
Fill in the text:
[Desktop Entry]
Name=Eclipse
Comment=Eclipse IDE
Exec=/Opt/Eclipse/eclipse
icon=/opt/eclipse/ ICON.XPM
terminal=false
type=application
categories=application;development;
Then go to the/opt/directory to build Eclipse's shortcut desktop (same as Windows).
It is recommended to pin it directly to the starter.
Ubuntu 12.04 Installation Java Development environment (jdk1.7 + Eclipse)