Two ways to install the JDK in Ubuntu

Source: Internet
Author: User

Method One:

This method is relatively simple, to ensure that the virtual machine network unimpeded

sudo apt-get update

sudo apt-get install Default-jre

sudo apt-get install DEFAULT-JDK

The above is the default installation version

If you want to install a specific version

sudo apt-get install Openjdk-6-jre

sudo apt-get install OPENJDK-6-JDK

Java 7 can be installed using the following command

sudo apt-get install Openjdk-7-jre

sudo apt-get install OPENJDK-7-JDK

Method Two:

Install the VM Tools tool first

Click: Virtual machine-–> install VM tools

Then find that the desktop will jump out the following questions:

The client operating system has locked the CD-ROM and may be using a CD-ROM, which may cause the client to fail to recognize the media changes. If possible, eject the CD-ROM from within the client before disconnecting.

Are you sure you want to disconnect and overwrite the lock settings?

Select--Install selection--yes (Y)

Then open the CD/DVD drive icon in the lower left corner of your virtual machine.

If you open it, there is a compressed file, such as. It means that you can install it directly. Please continue to see step three below. You can skip step two. If you open your CD/DVD disc drive find nothing inside. So don't worry, look at the second step to solve. Then the third step is installed again.

Step Two:

First off your Ubuntu virtual machine. Then search for Linux.iso in your computer. This is an image file. It provides some of the tools required for the Linux operating system platform, including, of course, the VMware Tools installation files (which are generally available). For convenience we can copy it directly (Linux.iso) to the same folder as your Ubuntu image. Such as

Then go to your virtual machine to open the interface. Select Edit Virtual machine settings

Change the image file path of the CD/DVD (STAT) to the linux.iso you just copied

Step Three:

Put your CD/DVD under the

This file is extracted to your working directory "download"

Then open the terminal and switch your users to root first.

Default installs Ubuntu does not have root user, this oneself solves. You can see some of the configuration after Ubuntu14.04 installation

The general is to use the root user to install, but you see, can also, ordinary users, direct./vmare-instaall.pl will be rejected, but sudo can.

Then, always enter,,,yes the place press Yes,no to press ENTER

OK, now the installation is successful!

First switch to root user

The initial is no, we need to create a new password for root

Switch to the root user

Create a directory to hold the JDK

Copy the downloaded installation package to the directory/home/laogong/jdk; this directory needs to be created by itself, switch to this directory with the CD command, LS to view the files in this directory

Copy the package to the/USR/LOCA/JDK directory via the CP command and view it in the/USR/LOCA/JDK directory

Decompression TAR-ZXVF jdk-7u79-linux-x64.tar.gz

Unzip complete!

Remove Unpacking Package

RM-RF jdk-7u79-linux-x64.tar.gz

Set permissions under

Next, modify the environment variables

Make environment variables effective immediately

SOURCE ~/.BASHRC

Set the system default JDK version

Because I have previously installed OPENJDK so this is the result, select the JDK version as needed, and finally java-version to see if the installation was successful

Two ways to install the JDK in Ubuntu

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.