How to install JDK in Ubuntu and JDK in Ubuntu

Source: Internet
Author: User

How to install JDK in Ubuntu and JDK in Ubuntu
Download JDK

1. Download the related JDK from the Oracle official website.

2. Create a folder under your account and name it "Java". Of course, you can name the folder at will.

That is, in/home/user/Java, my location is/home/nomasp/Java. Then extract the downloaded file and copy it here.

3. Open the terminal. If the terminal cannot be found, search for it.

Configure Environment Variables

Tips: use Ctrl + H to show hidden files.

1. Enter:

sudo emacs /etc/environment

This command uses emacs to open the environment file in the etc folder. (Root is required for some content in this tutorial. Please refer to the following link: Get root permission on Ubuntu (Linux ).

In addition to emacs, you can also use the built-in gedit.

sudo gedit /etc/environment

2. Add the following content to the environment file:

export JAVA_HOME=/home/user/Java/jdk1.8.0_60 export JRE_HOME=/home/user/Java/jdk1.8.0_60/jre export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib 

Here, user is your account name. For example, if I enter nomasp here and jdk1.8.0 _ 60 is the JDK version number, the download may be different.

3. Continue to modify the file and enter:

sudo emacs /etc/profile

The content of this file is too large. After three f1 instances, fill in the blank space before the word ummask:

export JAVA_HOME=/home/user/Java/jdk1.8.0_60 export JRE_HOME=/home/user/Java/jdk1.8.0_60/jre export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$JAVA_HOME/bin 

4. Save the preceding changes and log out.

5. Test JDK. Enter the following in the terminal:

jdk -version

If "java version" 1.8.0 _ 60 "is displayed, JDK is successfully installed.

Copyright Disclaimer: This article is an original article by NoMasp ke yuwang. If you need to reprint it, please contact me.

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.