Install JDK1.7 + Eclipse in Ubuntu

Source: Internet
Author: User
Recently, I started to use Ubuntu to write some code. Therefore, you need to use Eclipse, configure Eclipse, and write the process for your reference. 1. download JDK and Eclipse: Download JDK and Eclipse at the same time. I like to select a download group myself...

 

Recently, I started to use Ubuntu to write some code. Therefore, you need to use Eclipse, configure Eclipse, and write the process for your reference.

1. download JDK and Eclipse

 

First, download JDK and Eclipse. This step can be performed simultaneously. I prefer to download the components myself, so I didn't install it using sudu apt-get install sun-java-jdk6.

 

Go to http://www.eclipse.org/downloads/eclipseto download the corresponding eclipse.

 

Download JDK. The address is JDK. I chose the tar 32-bit tar package, because after downloading the package, I can decompress the package directly using the archive manager (My Ubuntu is not Fedora. after rpm is decompressed, or the alien conversion is always unable to be connected using the link method. if any of you can solve this problem, you can give it for your reference .)

 

Here, I downloaded the compressed packages for Eclipse and JDK1.7, and created a folder named SDK under/home/$ username.

 

Decompress the JDK package to get a folder and rename it to JDK 7 (do not rename it as needed). The jdk7 folder contains the bin and jre files.

 

Decompress Eclipse to obtain an eclipse folder. As in windows.

2. JDK configuration

 

In this example, the vim editor is used, and the vi editor is used by default in Ubuntu. the method is the same, but replace vim in the following text with vi.

 

Method 1,

 

Open the/home //. bashrc file and modify the file to update the environment variable.

 

The specific method is: open the terminal and enter the sudo vim/home/sunny/. bashrc file (my user name is sunny. if it is used, change it to your Ubuntu user name)

Here we will introduce in detail, after opening with vim, we will ask which mode to use. here we press E to modify the mode. Then press the letter I to enter the insert state (insert) for editing. after opening the file, add the following lines at the end of the file:

 

Export JAVA_HOME =/home/sunny/SDK/jdk (specify your jdk installation directory here)

 

PATH =.: $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH

 

Then, press Esc to enter the command line status, enter Command: w to save, q to exit. Open a terminal and type java-version to check whether the update has been made.

 

Method 2,

(1) modify/etc/enviroment and/etc/profile

 

Modify the enviroment file, sudo vim/etc/enviroment, and edit enviroment (I ):

 

The content is PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: /usr/games ", enter below this line

Export JAVA_HOME =/home/sunny/SDK/jdk7

 

Export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib

 

Exit edit mode (Esc), save the file (: w), and exit (: q)

 

(2) modify the profile file

Sudo vim/etc/profile

Add the following statement before umask 022

 

Export JAVA_HOME =/home/sunny/SDK/jdk7

 

Export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib

 

Export PATH = $ JAVA_HOME/bin: $ PATH: $ HOME/bin

 

Log out of the system, open the terminal, and enter java-version. If no exception occurs, you can see the java version information.

 

Note: Select one of the above methods!

 

3. start Eclipse

 

My directory is to compile the Java program, so I directly downloaded the Java version of Eclipse and decompressed it in the first step. Now, you can directly open it and run it.

 

If you have any questions, leave a message and I will try my best to solve them.

 

Author Sunny

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.