Install JDK 8 and Eclipse on Ubuntu 12.04

Source: Internet
Author: User
Tags gtk

Install JDK 8 in Ubuntu 12.04

Method 1: (the disadvantage is that a large number of programs such as openjdk cannot be removed during installation. The advantage is that the installation is simple)

$ Sudo apt-get install eclipse


Method 2: (the installation content is refreshing, but the disadvantage is that the configuration is troublesome)
1. Install JDK, refer
1. Download JDK 8
Download the latest JDK 8 version of JDK from http://www.oracle.com/technetwork/java/javasebusiness/downloads.

2. decompress the file
$ Sudo mkdir/usr/lib/jvm
$ Sudo mv jdk-8u5-linux-i586.tar.gz/usr/lib/jvm/

$ Cd/usr/lib/jvm/
$ Sudo tar-zxvf jdk-8u5-linux-i586.tar.gz
$ Rm./jdk-8u5-linux-i586.tar.gz

3. Configuration

$ Sudo gedit/etc/environment

Modify the PATH in environment, append the jdk path, and add CLASSPATH and JAVA_HOME as follows:
PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/lib/jvm/jdk1.8.0 _ 05/bin"
CLASSPATH = "/usr/lib/jvm/jdk1.8.0 _ 05/lib"
JAVA_HOME = "/usr/lib/jvm/jdk1.8.0 _ 05"

Then we want to tell the system that we are using sun's JDK, instead of OpenJDK:

$ Sudo update-alternatives -- install/usr/bin/java/usr/lib/jvm/JDK 1.8.0 _ 05/bin/java 300
$ Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jvm/jdk1.8.0 _ 05/bin/javac 300
$ Sudo update-alternatives -- config java
Two candidate items can be used to replace java (/usr/bin/java ).
Select the path priority status
------------------------------------------------------------
* 0/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 automatic mode
1/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2/usr/lib/jvm/jdk1.8.0 _ 05/bin/java 300 manual mode
To maintain the current value [*], press the Enter key or enter the selected number: 2

As shown above, you have set the java to be used.

4. run java-version.

The installation is successful as follows:

Java version "1.8.0 _ 05"
Java (TM) SE Runtime Environment (build 1.8.0 _ 05-b13)
Java HotSpot (TM) Server VM (build 25.5-b02, mixed mode)


Install Eclipse in Ubuntu 12.04

1. Download the Eclipse package from http://www.eclipse.org/downloads/index-demo.php. for example: Eclipse IDE for C/C ++ Developers

2. decompress the file
$ Sudo mv eclipse-standard-kepler-SR2-Java8-linux-gtk.tar.gz/usr/lib // move the installation package to the installation directory
$ Cd/usr/lib // enter the installation directory
$ Sudo tar-zxvf eclipse-standard-kepler-SR2-Java8-linux-gtk.tar.gz // unzip the installation package
$ Sudo rm./eclipse-standard-kepler-SR2-Java8-linux-gtk.tar.gz // Delete the installation package

3. decompress the package to an eclipse folder./Usr/lib/eclipse// Start eclipse

4. create shortcuts
$ Sudo gedit/usr/share/applications/eclipse. desktop

Ubuntu 12.04 uses the Unity interface and adds an initiator bar on the left side of the desktop. We can place an icon in the starter bar of our commonly used software for quick start. Each icon in the initiator column corresponds to a file in the/usr/share/applications directory.

To create a startup bar icon for eclipse, you can create an eclipse file under the/usr/share/applications directory. desktop (the file name can be arbitrary, but the file name suffix must be. and then copy the following content:

[Desktop Entry]
Type = Application
Name = Eclipse
Comment = Eclipse Integrated Development Environment
Icon =/usr/local/development/eclipse-indigo-3.7.2/icon. xpm
Exec = eclipse
Terminal = false
Categories = Development; IDE; Java;






Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.