Operating system: Linux X64/ubuntu 14.04
Java JDK Version: jdk-8u65-linux-x64.tar.gz
Disclaimer: Reprint Please indicate the source and the article link
1. Go to 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 downloads folder by default.
2. Create a folder under the appropriate path to store the Java JDK, this example selects the new JVM subfolder under the/OPT directory. Operation is as follows
Open Terminal (later becomes T1), enter:
Cd/opt #进入到opt目录
sudo mkdir JVM #新建一个jvm文件夹
LS #显示成功新建的jvm文件夹
CD JVM #进入jvm文件夹
3. Copy the downloaded JDK compression package to the JVM directory. Operation is as follows
Create another terminal window (T2) and enter:
CD Downloads #进入Downloads文件夹
LS #显示刚刚下载的JDK文件,
sudo cp JDK-8U65-LINUX-X64.TAR.GZ/OPT/JVM #将文件拷贝到刚刚新建的jvm文件夹中 (This will change the file name to its own JDK version, after the same)
sudo rm jdk-8u65-linux-x64.tar.gz #删除本目录下的安装包 (optional)
4. Unzip the installation Java JDK and configure the environment variables. Operation is as follows
Back to the first terminal (T1), enter:
ls #显示拷贝过来的JDK安装包
sudo tar-zxvf jdk-8u65-linux-x64.tar.gz #将安装包解压
ls #显示解压出的JDK文件夹, and the original installation package
sudo rm jdk-8u65-linux-x64.tar.gz #删除原安装包
sudo gedit/etc/profile #打开etc目录下的profile文件
5. Configure Global environment variables. Operation is as follows
Add the JDK installation path at the end of the Open profile document (you need to confirm it carefully):
#set Java Environment
Export java_home=/opt/jvm/jdk1.8.0_65
Export JRE_HOME=${JAVA_HOME}/JRE
Export classpath=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATH
Export path= $JAVA _home/bin: $JRE _home/bin: $PATH
6. Save and close the document. (Note: You can also use the VIM command to edit etc/profile, open the command: sudo vim/etc/profile, press <Insert> to enter edit mode,<esc> key exit edit mode, then press ":" and then enter "wq!" Save and exit; enter "q!" Do not save exit)
7. Enable configuration and verify. In Terminal input:
Java-version
8. The display effect is similar to the following for success:
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)
Finish
Setting up the Java development environment of Ubuntu system