Original address: Ubuntu 18.04 LTS Installation java10 and problem description
1. Download the appropriate installation package, such as jdk-10.0.1_linux-x64_bin.tar.gz. :
Http://www.oracle.com/technetwork/java/javase/downloads/index.html
2. Unzip the file, the specific file name needs to refer to the actual downloaded version.
tar -zxvf jdk-10.0.1_linux-x64_bin.tar.gz
3. Move to the Library directory of the system.
sudo mv jdk-10.0.1 /usr/lib/
USR is the UNIX system resource abbreviation. In each library directory,/lib are kernel-level,/usr/lib are system-level, and/usr/local/lib are user-level.
So/usr/lib and/usr/local/lib can be placed in the JDK, it is recommended to place in/usr/lib.
Some tutorials Add a JDK directory on top of jdk-10.0.1, but be sure to match the environment variable path set below.
4. Setting Environment variables
Modify the global configuration file for all users:
or modify the current user profile to act on the current user only:
Java because most users need to use, it is recommended to modify/etc/profile. Add the following to the file
- Export java_home=/usr/lib/jdk-10.0.1
- export classpath=.:${java_home}/lib
- export path=.:${java_home}/bin:$PATH
Note that the actual content of the path needs to be determined based on the version and path of the previous step. Jre_home does not need to be configured in JAVA10 because the downloaded files no longer have the JRE directory, and the Java executable file is also archived in the bin directory.
Make the modified configuration effective immediately:
source /etc/profile
Or
source ~/.bashrc
The source command takes effect only at the current session, and requires a system restart if it is required to be globally active
5. Check
java -version
Normal should show:
Java version "10.0.1" 2018-04-17
Java (TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot (TM) 64-bit Server VM 18.3 (build 10.0.1+10, Mixed mode)
Turn: Ubuntu 18.04 LTS installation java10 (JDK) and problem description