Deepin System Manual Installation Oracle Jdk8 detailed tutorials
Download the JDK archive from Oracle website and extract the files using sudo tar-zxf jdk***, which I placed under the HOME/DIY/JAVA/JDK path.
JDK file path:/home/diy/java/jdk/jdk1.8.0_152
JDK environment variable Configuration
Modifying a configuration file
sudo vi/etc/profile
After entering, knock on I, then you can edit the content.
Add content at the end of a file
Java_home=/home/diy/java/jdk/jdk1.8.0_152
Classpath=/home/diy/java/jdk/jdk1.8.0_152/lib
Path= $PATH: $JAVA _home/bin: $CLASSPATH
Export PATH
Use ESC, then enter: Wq, save exit
To make the configuration effective, command-side input:
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:
sudo update-alternatives--install/usr/bin/javac Javac/home/diy/java/jdk/jdk1.8.0_152/bin/javac 1171
sudo update-alternatives--install/usr/bin/java Java/home/diy/java/jdk/jdk1.8.0_152/bin/java 1171
sudo update-alternatives--install/usr/bin/jar Jar/home/diy/java/jdk/jdk1.8.0_152/bin/jar 1171
sudo update-alternatives--install/usr/bin/javah javah/home/diy/java/jdk/jdk1.8.0_152/bin/javah 1171
sudo update-alternatives--install/usr/bin/javap javap/home/diy/java/jdk/jdk1.8.0_152/bin/javap 1171
Update-alternatives is a tool dedicated to maintaining system command links in the Ubuntu system, with the following 1171 being used to specify the priority of the current link, and the highest priority will automatically be 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
There are 2 candidates that can be used to replace Java (providing/usr/bin/java).
Select 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
View Java version
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=gasp
Java Version "1.8.0_152"
Java (TM) SE Runtime Environment (build 1.8.0_152-B16)
Java HotSpot (TM) 64-bit Server VM (build 25.152-b16, Mixed mode)
If the Tomcat folder is not recognized when you encounter Eclipse configuration Tomcat8, the reference may be a file permission issue:
-R recursively perform an operation, whether deleting a folder or modifying all file permissions under a folder
Permissions change, 777 equals Full Control permissions:
Change permissions for a folder or file: chmod 777 file path/file name
To change permissions for all files under a folder: sudo chmod-r 777 folder
Deepin System Manual Installation Oracle Jdk8 detailed tutorials