Because the project is needed, install the Java environment on the machine.
1, go to http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html download, select the Accept License Agreement
Jdk-7u71-linux-x64.tar.gz with Linux x64 selected
2, #接下来找个目录来放sun JDK, here we put the/usr/java, and figure out the version, such as Java8 in/usr/java/java8, Java7 in/usr/java/java7
Create the/usr/java directory, then unzip the package and move to the/USR/JAVA/JAVA7
#mkdir/usr/java && tar-zxvf jdk-7u71-linux-x64.tar.gz && mv Jdk1.7.0_71/usr/java/java7
3, write environment variables for Java
Open your. bashrc file with an editor. This has two, one in/ROOT/.BASHRC, one in/home/your USERNAME/.BASHRC (do not write/etc/environment is not want to affect the global system environment variables)
Add the following content and save it.
Export Java_home=/usr/java/java7export path= $PATH: $JAVA _home/binexport classpath=.: $JAVA _home/lib: $JAVA _home/jre/ Lib
Then
#source/ROOT/.BASHRC cut to your user under source. #echo $JAVA _home/usr/java/java7
For openjdk that have not been installed, enter directly at the terminal
#/usr/java/java7/bin/java-version
At this point we begin to make a link. Add to the system bin and use the update-alternatives command to maintain the soft connection of the system by updating this to let the system know which command to use. The last parameter is the priority. The higher the better.
#update-alternatives--install/usr/bin/java Java/usr/java/java7/bin/java 1100#update-alternatives--install/usr/ Bin/javac Javac/usr/java/java7/bin/javac 1100
Next configuration, if you installed the OPENJDK, here you can choose. Because I gave a higher priority 1100 ahead, so now the default is already/usr/java/java7.
#update-alternatives--config Java
#update-alternatives--config Javac
<pre name= "code" class= "python" >[email protected]:/# update-alternatives--config javathere is 2 choices for the AL ternative Java (Providing/usr/bin/java). Selection Path Priority Status-------------------------------------------- ----------------0/usr/java/java7/bin/java 1100 Auto mode* 1/usr/jav A/java7/bin/java 1100 Manual Mode 2/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/jav A 1061 manual mode
[Email protected]:/# update-alternatives--config Javacthere is 2 choices for the alternative Javac (providing/usr/bin/j AVAC). Selection Path priority Status------------------------------------------------------------* 0 / Usr/java/java7/bin/javac 1100 Auto mode 1 /usr/java/java7/bin/javac 1100 Manual mode 2 /usr/lib/jvm/java-6-openjdk-amd64/bin/javac 1061 Manual mode
Then directly under the terminal input Verification java7 is installed OK
#java-version
Java version "1.7.0_71" Java (tm) SE Runtime Environment (build 1.7.0_71-b14) Java HotSpot (tm) 64-bit Server VM (Build 24.71- B01, Mixed mode)
Debian (wheezy) installs Java environment/replaces OPENJDK as Sun JDK