Java Development Environment under Ubuntu14.04

Source: Internet
Author: User
Note: The following content is my personal experience. I have been in touch with the Ubuntu system since 10.04 and have been in the twinkling of an eye for four years. I have visited various related forums and found that from the beginning to the present, many people on the Forum asked questions about JAVA environment configuration. So I will summarize my personal experience as follows, which is only for reference by new users! Start. First java development environment includes some basic content: 1. jdk installation ---- jdk-6u45-linux-x64.bi

Note: The following content is my personal experience. I have been in touch with the Ubuntu system since 10.04 and have been in the twinkling of an eye for four years. I have visited various related forums and found that from the beginning to the present, many people on the Forum asked questions about JAVA environment configuration. So I will summarize my personal experience as follows, which is only for reference by new users!

Start.

First, the java development environment includes some basic content:

1. jdk installation ---- jdk-6u45-linux-x64.bin

2. eclipse installation ----eclipse-jee-kepler-SR2-linux-gtk-x86_64.tar.gz reference: http://www.linuxidc.com/bcsflilong/p/4197458.html

3. tomcat installation ----apache-tomcat-6.0.39.tar.gz

4. Database Installation

Start with JDK installation.

In fact, to sum up the installation of JDK, extract andConfigure Environment Variables

First decompress the jdk-6u45-linux-x64.bin in a proper place, the operation is as follows:

Cd/opt # enter the/opt directory
Sudo mkdir DevelopTools # create the DevelopTools directory
Cd DevelopTools
Sudo mkdir jvm
Cd jvm
Sudo cp/home/download/jdk-6u45-linux-x64.bin/opt/DevelopTools/jvm
Sudo chmod a + x jdk-6u45-linux-x64.bin
Sudo sh jdk-6u45-linux-x64.bin
# Decompress the package to obtain the folder
Linuxidc @ ubuntu:/opt/DevelopTools/jvm $ ls-l
Total usage 4
Drwxr-xr-x 8 root 4096 jdk1.6.0 _ 45, December 2013

The JDK has been decompressed by a few steps above. In fact, the writing steps are very simple and there is nothing to say.

The following section describes how to configure environment variables. This step is depressing for many new users. problems often occur here, and even the system cannot log on normally (this is because the system enters the password and returns to the logon page cyclically)

To configure environment variables,

The first is the symbol. It is clear that in ubuntu or other linux distributions, When configuring environment variables, the separator is [:] instead of [;].

The second is to back up files before configuration. This is actually a good habit. If an error occurs, you can restore it immediately.

Let's get started and start to configure environment variables. First, you have to think about it. Do you want to apply JDK to all accounts that the system can use or is it just the current user? In fact, there is nothing here, that is, configuring the environment variable

Files are different.

First, let's configure the JDK that can be used by all users as an example to configure environment variables.

Back up the file to be modified

sudo cp /etc/profile /etc/profile.old

Edit File

sudo gedit /etc/profile

Add the following content at the end of the file:

#JDK PATHexport JAVA_HOME=/opt/DevelopTools/jvm/jdk1.6.0_45export JRE_HOME=/opt/DevelopTools/jvm/jdk1.6.0_45/jreexport CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATHexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

The following is a description of the content added above

# JDK PATHexport JAVA_HOME =/opt/DevelopTools/jvm/jdk1.6.0 _ 45 # Tell the system that JAVA_HOME is at/opt/DevelopTools/jvm/jdk1.6.0 _ 45 (this is the path decompressed above) export JRE_HOME =/opt/DevelopTools/jvm/jdk1.6.0 _ 45/jre # Tell the system that JRE_HOME is in opt/DevelopTools/jvm/jdk1.6.0 _ 45/jreexport CLASSPATH =.: $ JAVA_HOME/lib: $ JRE_HOME/lib: $ CLASSPATH
# Configuring CLASSPATH. If you have experience configuring CLASSPATH in windows, it must be easy to understand.
# [.] Add the current directory to CLASSPATH
# [$ JAVA_HOME/lib] Add the lib directory under JAVA_HOME to CLASSPATH
# [$ JRE_HOME/lib] Add the lib directory under JRE_HOME to CLASSPATH
# [$ CLASSPATH] append the original CLASSPATH
# The symbol description above [:] is equivalent to [;] in windows. [$ JAVA_HOME/lib] is written in winodws as % JAVA_HOME % \ libexport PATH = $ JAVA_HOME/bin: $ JRE_HOME/bin: $ PATH.
# Configure PATH [$ JAVA_HOME/bin] and [$ JRE_HOME/bin:] to add the bin in JAVA_HOME and JRE_HOME to the PATH
# $ PATH append the original PATH

After saving/etc/profile, the environment variable is configured. Note the configuration in PATH,

The most common error is

Set

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

Written

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin 

This will cause you to progress the system after restarting. Why. Because you write it like this, it is equivalent to re-assigning a value to PATH instead of appending JDK-related content. Therefore, unexpected errors may occur.

Many new users do not dare to modify the file, or do not know whether the modification is correct. The configuration is correct or not by checking javac-version after restart.

In fact, to avoid errors, You can first verify whether the modified profile file is correct.

Open Terminal

Input

 source /etc/profile

If there is no prompt, continue to enter java-version. If the output similar to the following is displayed, it will prove that you have succeeded. Restart with confidence.

linuxidc@ubuntu:~$ java -versionjava version "1.6.0_45"Java(TM) SE Runtime Environment (build 1.6.0_45-b06)Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)linuxidc@ubuntu:~$ javac -versionjavac 1.6.0_45 

By the way, I forgot to mention that the configuration is only applicable to the JDK environment variables that take effect for the current user. The/etc/profile is global. to configure the current user, modify the $ HOME/. profile file.

Install JDK 7 (with Clojure download) http://www.linuxidc.com/Linux/2012-10/71557.htm under Ubuntu

Install JDK1.7 http://www.linuxidc.com/Linux/2012-06/62239.htm in Ubuntu 12.04

CentOS6.3 install JDK and environment configuration http://www.linuxidc.com/Linux/2012-09/70780.htm

Ubuntu14.04 64-bit installation JDK1.7 http://www.linuxidc.com/Linux/2015-01/111102.htm

For more details, refer to the highlights on the next page.: Http://www.linuxidc.com/Linux/2015-01/111974p2.htm

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.