The process of installing the JDK under Linux ubuntu14.04

Source: Internet
Author: User
Tags gz file

First go to Oracle official online download JDK, I download is jdk-8u51-linux-x64.tar.gz this version, official web also has a RPM file, this is a red Hat company installs a version, started I download this version, then also installs the RPM in Ubuntu , but at the end of the day, when installing this RPM JDK, I encountered many errors and displayed a row of errors. Then on the official website decisively downloaded the tar. GZ file. The installation is successful and the installation process is as follows
We downloaded the jdk-8u51-linux-x64.tar.gz file, the default is in the/home/ranruilong/download this folder, here Ranruilong is my user name directory, in the home directory can see our own installation directory, This will be replaced by your own user directory.
Then unzip the compressed file, unzip the command
sudo tar zxvf./jdk-8u51-linux-x64.tar.gz//here./Do not forget to write, representing the current directory
After decompression in the current directory, there is a jdk1.8.0_51
You can see it by entering LS in the terminal.
The JDK is typically installed in the/OPT directory, and we move the extracted files above to/OPT/JAVA/JDK
In the terminal input command: cd/opt
New Java directory: mkdir Java
Go to Java directory: CD java
New Jdk:mkdir JDK
Once the folder is set up, go back to the start download directory
cd/home/ranruilong/Download
Input: MV JDK1.8.0_51/OPT/JAVA/JDK//To move the extracted files to the JDK directory
Into the JDK can be queried, in the original download directory, you will find that the decompression files have been removed by us.
The next step is to set the environment variables. Because we download the time tar.gz compressed files, so directly extracted, put in the directory we want, and then set the environment variables, you can use the
Edit. bashrc file
Enter: VI ~/.BASHRC command in terminal, edit BASHRC file
Here is the operation of VI, very simple
In Terminal input: I (small i) edit the BASHRC file
Add the following variable at the end of the BASHRC
Export java_home=/opt/java/jdk1.8.0_51//directory of JDK here, is the directory installed by itself
Export Classpath=${java_home}/lib:. There must be a +. Path separator: The first time I did not add, and then run the Java file when the old cannot find the main class
Export Path=${java_home}/bin: $PATH
Then press ESC on the keyboard to return to command mode
Input: Wq Save the file we just modified
Finally, enter the source ~/.BASHRC. You can do it.
Now let's test if the installation is successful.
In the terminal input java/javac/java-version, there will be some Java-related content, congratulations, the installation was successful.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The process of installing the JDK under Linux ubuntu14.04

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.