First, download the JDK package on the network at the following URL:
Choose the version you want!
Https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
First, unzip the file and copy it to the directory you specified (download the package at the end of the tar)
1, unzip the file in the current directory: TAR-XZVF [package name]
2, in the Usr/local directory to establish the folder I Need "Java", give permission 755, the command is: Mkdir-m 755 java, you can also create a good file directly, later change the permissions, the command is: A, mkdir [name], B, sudo chmod 755 [file Extension
Note: Insufficient permissions can be directly added sudo
3. Move the extracted files to the created file, the command is: MV Jdk1.8.1._181/usr/local/java
Now that you've done your preparation, you can start configuring environment variables!
Second, configure the Java environment variables
Command: sudo gedit/etc/profile edit the file
Add a three-line configuration to the end of the file:
Export java_home=/usr/local/java/jdk1.8.0_181
Export classpath=.: $JAVA _home/lib: $JAVA _home/jre/lib: $CLASSPATH
Export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH
Save!
Execute command: source/etc/profile implementation
In this case, the Java environment variables are fully configured, can be detected OK, the detection command is: Java, java-version, Javac
If there is a corresponding configuration, it represents the JDK environment OK!
For more information on Tomcat configuration, see the next blog post.
Use Ubuntu-----to lay out your Java environment