|
Description: The following are my personal experience, contacts, Ubuntu 10.04 system from the start, has gone four years between the twinkling of an eye, frequently visit all relevant forums, I found that from the beginning of the foundation to the present, there are a lot of people in the forum ask questions about the JAVA environment configuration. So I summarize my personal experience as hereinafter provided for reference novice, veterans bypass!
Start Here.
First, java development environment includes some basic elements:
1.jdk install ---- jdk-6u45-linux-x64.bin
2.eclipse install ---- eclipse-jee-kepler-SR2-linux-gtk-x86_64.tar.gz
3.tomcat install ---- apache-tomcat-6.0.39.tar.gz
4. Install Database
JDK installation start talking.
In fact, the installation JDK summed up on two points unpack and configure the environment variables
First, a suitable place to decompress jdk-6u45-linux-x64.bin, as follows:
cd / opt # enter the / opt directory
sudo mkdir DevelopTools # New DevelopTools directory
cd DevelopTools
sudo mkdir jvm
cd jvm
sudo cp / home / 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
Obtained after extracting the folder #
linuxhost @ ubuntu: / opt / DevelopTools / jvm $ ls -l
The total amount of 4
drwxr-xr-x 8 root root 4096 3 Yue 27 2013 jdk1.6.0_45
A few steps from the above, JDK has been unpacked completed, in fact, write the steps are simple, there is nothing more to say.
The following configuration environment variable to say is, this step is to make many novice depressed, and often there is a problem here, or the system can not log in normally (after entering the password phenomenon is recycled back to the login page)
To configure the environment variables need of points,
The first is the symbol clearly in ubuntu or any other linux distributions, the split symbols when configuring environment variable is [:] instead of [;]
The second configuration is in front, to make a backup file, which is actually a good habit. Once the error can be immediately restored.
Here we go, began to configure the environment variables, the first thing you want good, you want to configure the system all accounts can all be applied JDK or just the current users? In fact, nothing here, is to configure the environment variables
File may vary.
I will make all JDK to configure user example configuration environment variable.
Backup file you want to edit
sudo cp / etc / profile /etc/profile.old
Edit File
sudo gedit / etc / profile
In the final document by adding the following
#JDK PATH
export JAVA_HOME = / opt / DevelopTools / jvm / jdk1.6.0_45
export JRE_HOME = / opt / DevelopTools / jvm / jdk1.6.0_45 / jre
export CLASSPATH =:. $ JAVA_HOME / lib: $ JRE_HOME / lib: $ CLASSPATH
export PATH = $ JAVA_HOME / bin: $ JRE_HOME / bin: $ PATH
The following is a description of the above add content
#JDK PATH
export JAVA_HOME = / opt / DevelopTools / jvm / jdk1.6.0_45 # tell the system JAVA_HOME in /opt/DevelopTools/jvm/jdk1.6.0_45 (this is the extract from the above that path)
export JRE_HOME = / opt / DevelopTools / jvm / jdk1.6.0_45 / jre # tell the system JRE_HOME in opt / DevelopTools / jvm / jdk1.6.0_45 / jre
export CLASSPATH =:. $ JAVA_HOME / lib: $ JRE_HOME / lib: $ CLASSPATH
# Set the CLASSPATH if you have experience in windows configuration, there must be well understood
# [.] Will be added to the current directory CLASSPATH
# [$ JAVA_HOME / lib] will be added under the lib directory JAVA_HOME CLASSPATH
# [$ JRE_HOME / lib] will be added under the lib directory JRE_HOME CLASSPATH
# [$ CLASSPATH] will come in additional original CLASSPATH
# Symbol of the instructions that appear on the above [:] pretty and windows under the [;], [$ JAVA_HOME / lib] such wording is at winodws% JAVA_HOME% \ lib
export PATH = $ JAVA_HOME / bin: $ JRE_HOME / bin: $ PATH
# Configure PATH [$ JAVA_HOME / bin] and [$ JRE_HOME / bin:] was actually the bin JAVA_HOME and PATH added under JRE_HOME
# $ PATH appends the original PATH
Save / etc / profile after the environment variable configuration finished, here is the need to pay special attention here PATH configuration,
The most common mistake is
will
export PATH = $ JAVA_HOME / bin: $ JRE_HOME / bin: $ PATH
Wrote
export PATH = $ JAVA_HOME / bin: $ JRE_HOME / bin
This will lead to progress you reboot the system, and why. Because you write, comparable to the re-assignment to PATH JDK instead of additional relevant content. So there will be some unexpected errors
Many beginners can not modify the file, or do not know the right modification, or not configured properly look after the restart through javac -version to judge.
In fact, you can avoid the mistakes to verify profile modified files are no problem.
Open a terminal
enter
source / etc / profile
If you do not have any tips, please continue to enter java -version If the output appears similar to the following to prove you are successful, rest assured restart it.
linuxhost @ ubuntu: ~ $ java -version
java 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)
linuxhost @ ubuntu: ~ $ javac -version
javac 1.6.0_45
Yes forgot to say configured only for JDK environment variables of the current user, / etc / profile is global, necessarily want to configure the current user, modify the $ HOME / .profile file.
Let's install Eclipse!
Install Eclipse premise is that you have the JDK installed successfully
Well, to start the installation.
First, extract the eclipse-jee-kepler-SR2-linux-gtk-x86_64.tar.gz in the right place
cd / opt / DevelopTools / ide /
sudo cp / home / home / download /eclipse-jee-kepler-SR2-linux-gtk-x86_64.tar.gz / opt / DevelopTools / ide
sudo tar-zxvf eclipse-jee-kepler-SR2-linux-gtk-x86_64.tar.gz
After extracting obtained eclipse folder #
tone @ Ubuntu: / opt / DevelopTools / ide $ ls
eclipse
Directly run on it
cd / eclipse
./eclipse
This time will be able to see the familiar eclipse the start page
In order to facilitate the start, we can create a startup icon,
In fact, in order to later in a simple command line to start eclipse, we can create a startup script.
cd / usr / local / bin /
sudo vim eclipse
# Adding the following:
echo 'go eclipse home ...'
cd / opt / DevelopTools / ide / eclipse
echo 'start eclispe ...'
nohup ./eclipse> / dev / null 2> & 1
exit 0
#Esc: Wq
# Authorization
sudo chmod a + x eclipse
Create a startup icon
cd / usr / share / applications /
sudo vim Eclipse.desktop
# Add the following text
Name = Eclipse
Comment = A Java Development Tool
Exec = / usr / local / bin / eclipse # This is the startup script created earlier
Terminal = false
Type = Application
Icon = / opt / DevelopTools / ide / eclipse / icon.xpm
MimeType =
Categories = GTK; Java; Development;
#Esc: Wq
So far eclipse the simple installation is complete. |
|
|
|