Ubuntu Java development environment, ubuntujava
Operating System: Linux x64/Ubuntu 14.04
Java JDK version: jdk-8u65-linux-x64.tar.gz
Disclaimer: reprinted, please indicate the source and link to this article
1. Go to the ORACLE official website to download the latest version of Java JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html, and download it to the downloadsfolder.
2. Create a folder in the appropriate path to store Java JDK. In this example, create a new JVM sub-folder under the/opt directory. The operations are as follows:
Open Terminal (the last is T1) and enter:
Cd/opt # Go to the opt directory sudo mkdir jvm # create a new jvm folder ls # display the newly created jvm folder cd jvm # enter the jvm folder
3. Copy the downloaded JDK compressed package to the jvm directory. The operations are as follows:
Create another Terminal window (T2) and enter:
Cd Downloads # enter the Downloads folder ls # display the downloaded JDK file, sudo cp jdk-8u65-linux-x64.tar.gz/opt/jvm # copy the file to the newly created jvm folder (here change the file name to your corresponding JDK version, later the same) sudo rm jdk-8u65-linux-x64.tar.gz # Delete the installation package in the local directory (optional)
4. Unzip and install Java JDK and configure environment variables. The operations are as follows:
Return to the first Terminal (T1) and enter:
Ls # Show the copied JDK installation package sudo tar-zxvf jdk-8u65-linux-x64.tar.gz # unzip the installation package ls # Show the decompressed JDK folder, and the original installation package sudo rm jdk-8u65-linux-x64.tar.gz # Delete the original installation package sudo gedit/etc/profile # Open the profile file under the etc directory
5. configure global environment variables. The operations are as follows:
Add the JDK installation path at the end of the opened profile document (Please confirm carefully ):
#set java environmentexport JAVA_HOME=/opt/jvm/jdk1.8.0_65 export JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATHexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
6. Save and close the document. (Note: You can also run the vim command to edit etc/profile, open the command: sudo vim/etc/profile, press <Insert> to enter the edit mode, and <Esc> to exit the edit mode, press ":" and then enter "wq! "Save and exit; enter" q! "Do not save and Exit)
7. Enable configuration and verify. In Terminal, enter:
java -version
8. If the display effect is similar to the following, the operation is successful:
java version "1.8.0_65"Java(TM) SE Runtime Environment (build 1.8.0_65-b17)Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
(End)