Ubuntu 12.04 installs JDK 8 and Eclipse

Source: Internet
Author: User
Tags gtk

Ubuntu 12.04 under Install JDK8

Method One: (Disadvantage is the installation of additional OPENJDK and other large number of programs and can not be removed, the advantage is simple installation)

$ sudo apt-get install eclipse


Method Two: (The advantage is the installation content is refreshing, the disadvantage is the configuration trouble)
1. Installation of JDK, references
1. Download JDK 8
Choose the latest version of JDK 8 from the http://www.oracle.com/technetwork/java/javasebusiness/downloads/to download the JDK.

2. Unzip 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

Change path in environment, append JDK path, join? Classpath and Java_home After the following example:
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"

And then we're going to tell the system that we're using Sun's JDK, not OPENJDK:

$ sudo update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk1.8.0_05/bin/java 300
$ sudo update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jdk1.8.0_05/bin/javac 300
$ sudo update-alternatives--config java
There are 2 candidates that can be used to replace Java (providing/usr/bin/java).
Select Path Priority state
------------------------------------------------------------
* 0/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 own active 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 ENTER, or type the number of your choice: 2

As you can see, this sets up the Java that you want to use.

4. Test Execution Java-version

For example, the following is a successful installation:

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 under Ubuntu 12.04

1. Download Eclipse Download the appropriate version number from http://www.eclipse.org/downloads/index-developer.php, such as: Eclipse IDE for C + + developers

2. Unzip the file
$ sudo mv eclipse-standard-kepler-sr2-java8-linux-gtk.tar.gz/usr/lib///to move the installation package to the installation folder
$ cd/usr/lib///Enter the installation folder
$ 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 installation package

3, after the decompression is a directory called Eclipse. /usr/lib/eclipse/eclipse //Start eclipse

4. Create a shortcut
$ sudo gedit/usr/share/applications/eclipse.desktop

Ubuntu 12.04 uses the Unity interface, which has one more launcher bar on the left side of the desktop. We can put the software we use frequently in the launcher bar with an icon to enable high-speed startup. Each icon in the Launcher bar actually corresponds to a file under the/usr/share/applications folder.

In order to create a launch bar icon for Eclipse, we are able to create a file eclipse.desktop under the/usr/share/applications folder (the file name can be arbitrary, but the file name suffix must be. Desktop), 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.