Description: The following is my personal experience, contact Ubuntu system is starting from 10.04, the blink of an eye has been four years, often browse various related forums, found from the beginning of my foundation to the present, there are many people on the forum to ask about the Java environment configuration related issues. So I summed up my personal experience as below, only for novice reference, the birds bypass!
Start below.
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
3.tomcat installation----apache-tomcat-6.0.39.tar.gz
4. Database Installation
Start with the JDK installation.
In fact, the installation of the JDK summed up two points to extract and Configure environment Variables
First, unzip the jdk-6u45-linux-x64.bin in a suitable place, as follows:
CD/opt #进入到/opt directory sudo mkdir developtools #新建developtools/home/home/Download/jdk-6u45-linux-x64.bin/opt /developtools/jvmsudo chmod a+x jdk-6u45-linux-x64.binsudo sh jdk-6u45-linux-x64.bin# unzip to get folder [Email protected]:/opt/developtools/jvm$ ls-4drwxr-xr-x 8 root root 4096 March 2013 Jdk1.6.0_45
By the above steps, the JDK has been unpacked, in fact, the writing procedure is very simple, there is no more to say.
The following is to say that the configuration environment variables, this step is to make many novice depressed, often there is a problem here, and even cause the system can not log in normally (the phenomenon is to enter the password and loop back to the login page)
To configure the environment variables, you need to specify a few
The first is the sign, explicitly in Ubuntu or other Linux distributions, when configuring the environment variable when the split symbol is [:] instead of [;]
The second is in the configuration before, to do a good job of backup files, which is actually an excellent habit of the formation. Once an error occurs, you can restore it immediately.
The following walk, start to configure the environment variables, first you have to think well, your configuration is the system can all the accounts can be applied to the JDK or just the current user? In fact, there is nothing here, it is the configuration environment variable
Files are different.
Let me configure environment variables as an example by configuring a JDK that will allow all users to use it.
Back up the files you want to modify
sudo cp/etc/profile/etc/profile.old
Edit File
sudo gedit/etc/profile
At the end of the file, add the following:
#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 what was added above
#JDK pathexport java_home=/opt/developtools/jvm/jdk1.6. 0_45 #告诉系统JAVA_HOME in/opt/developtools/jvm/jdk1.60_45 (This is the path extracted above) export Jre_home=/opt/developtools/jvm/jdk1.6.0_45/JRE # tells the system jre_home in opt/developtools/jvm/jdk1.6.0_45/JREexport CLASSPATH=.: $JAVA _home/lib: $JRE _home/Lib: $CLASSPATH
#配置CLASSPATH If you have experience in configuring under Windows, it must be well understood
# [.] Add current directory to Classpath
# [$JAVA _home/lib] joins the Lib directory under Java_home classpath
# [$JRE _home/Lib] joins the Lib directory under Jre_home classpath
# [$CLASSPATH] Append the original CLASSPATH
# The description of the symbol above appears [:] Quite with windows [;], [$JAVA _home/lib] Such a notation under Winodws is%java_home%\libexport PATH= $JAVA _home/bin: $JRE _home/bin: $PATH
#配置path [$JAVA _home/bin] and [$JRE _home/bin:] Unexpectedly add java_home and jre_home bin to the path
# $PATH Append the original PATH
after saving the/ETC/PROFILE environment variable is configured, here need special attention is the path here configuration,
The most common mistake is
Will
Export path= $JAVA _home/bin: $JRE _home/bin: $PATH
Was written
Export path= $JAVA _home/bin: $JRE _home/bin
This will cause you to improve the system after the restart, why? Because you write like this, it's quite the same as re-assigning to path instead of appending JDK-related content. So there will be some unexpected mistakes.
Many novice do not dare to modify the file, or do not know whether the correct, configured correctly or not by restarting after looking at javac-version to judge.
In fact, to avoid errors you can first verify that the modified profile file has no problem.
Open Terminal
Input
source/etc/ Profile
If you do not have any hints, continue typing Java-version if the output similar to the following shows that you have succeeded, be sure to restart it.
[Email protected]:~$ java-"1.6.0_45"1.6.0_45-64-bit Server VM (build 20.45-b01, mixed mode) [email protected]:~$ javac-1.6.0_45
Yes, forget about it. Configure the JDK environment variable that is only valid for the current user,/etc/profile is global, altogether to configure the current user, modify the $home/.profile file.
Well today wrote this, the text may have typos, are the damned input method to make! Please crossing forgive me, other configuration please pay attention to future articles.
--1--JDK installation of the Java Development environment under Ubuntu 14.04