Recently installed in your own notebook Deepin Linux, although the use of the process found some bugs, but the overall feeling is good, ready to use her as a development system. The JDK that comes with the system is the open JDK, but the Oracle JDK is often required for Java development, so you need to install the Oracle JDK.
Download and install Oracle JDK
- Download tar.gz Package for JDK
Because I have developed a JDK7 so I downloaded it:
Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
You can also download the latest JDK from the Oracle website:
Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Go to download directory
CD ~/download
Unzip the tar.gz bag
tar -zxvf jdk-7u79-linux-x64. tar. gz
Installing the JDK
sudo MV Jdk1. 7. 0_79//USR/LIB/JVM/JAVA/JDK1. 7. 0_79
JDK environment variable Configuration
- Modifying a configuration file
sudo vim/etc/profile
Add content at the end of a file
Java_home=/usr/lib/jvm/jdk1.7.0_79classpath=/usr/lib/jvm/jdk1.7.0_79/libpath= $PATH: $JAVA _home/bin:$ Classpathexport PATH
Note the path and version of the JDK
- Make configuration effective
Source/etc/profile
Configuring the default JDK
- Create a new Java version
Create a new system command link in the shell with the update-alternatives command:
sudoUpdate-alternatives--Install/usr/bin/javac Javac/usr/lib/jvm/jdk1.7.0_79/bin/javac1171sudoUpdate-alternatives--Install/usr/bin/java Java/usr/lib/jvm/jdk1.7.0_79/bin/java1171sudoUpdate-alternatives--Install/usr/bin/jar Jar/usr/lib/jvm/jdk1.7.0_79/bin/jar1171 sudoUpdate-alternatives--Install/usr/bin/javah Javah/usr/lib/jvm/jdk1.7.0_79/bin/javah1171 sudoUpdate-alternatives--Install/USR/BIN/JAVAP Javap/usr/lib/jvm/jdk1.7.0_79/BIN/JAVAP1171
Update-alternatives is a tool dedicated to maintaining system command links in the Ubuntu system, and the following 1171 is used to specify the priority of the current link, and the highest priority is automatically set to the default version.
You can use the following command to view the version and priority of Java:
Update-alternatives--display Java
- Choose the version of Java
Execute command
Update-alternatives--config Java
Output
2 Candidates can be used to replace Java (provides/usr/bin/Java). Select the path priority State 0 /usr/lib/jvm/jdk1. 7. 0_79/bin/java 1171 Auto mode 1 /usr/lib/jvm/java-8 -openjdk-amd64/jre/bin/java 1081 manual mode 2 /usr/lib/ Jvm/jdk1. 7. 0_79/bin/java 1171 Manual mode
You can see that the JDK that you just configured has a 1.7 priority configuration of 1171, which is higher than the original 1081, so it is automatically set to default.
Test
Execute the following command on the shell
Java-version
If you get the following output, it proves that the JDK has successfully installed the configuration.
Picked up _java_options: -dawt.usesystemaafontsettings="1.7.0_79" 1.7. 0_79-24.79-b02, Mixed mode)
Reprint Please specify source: http://www.cnblogs.com/keitsi/p/5817433.html
Deepin Linux Installation JDK