Install jdk in ubuntu

Source: Internet
Author: User

Install jdk in ubuntu
The detailed steps for installing jdk1.7 in ubuntu14 are as follows:

http://www.cnblogs.com/plinx/archive/2013/06/01/3113106.html

 

1. Download from Sun's official website

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Select accept license, and then select JDK download suitable for your model.

2. decompress the file and modify the file name.

/× First enter the administrator privilege ×/
$ Sudo-I
/× Create a directory and decompress the file to the Created directory. ×/
# Mkdir/usr/lib/jvm # tar zxvf jdk-7u65-linux-i586.tar.gz-C/usr/lib/jvm
/× The following command is used to establish a soft connection ×/# ln-s/usr/lib/jvm/jdk1.7.0 _ 65/usr/lib/jvm/jdk1.7
/× Exit the Administrator permission ×/
# Exit

3. Add the environment variables at the end of the bashrc configuration file (the environment variables set here are only valid for the current user, and the. bashrc configuration files must be set for other users)

$ vim ~/.bashrc

Add the following content

Export JAVA_HOME =/usr/lib/jvm/jdk1.7export JRE_HOME =$ {JAVA_HOME}/jre export CLASSPATH =.: $ {JAVA_HOME}/lib :$ {JRE_HOME}/lib export PATH =$ {JAVA_HOME}/bin: $ PATH
/× Press esc and enter: wq to save and exit */

4. Configure the default JDK version.

/× Enter the Administrator permission, and then execute the following update-alternatives command ×/
$ Sudo-I
# Update-alternatives -- install/usr/bin/java/usr/lib/jvm/jdk1.7/bin/java 300 # update-alternatives -- install/usr/bin/javac/ usr/lib/jvm/jdk1.7/bin/javac 300 # update-alternatives -- install/usr/bin/jar/usr/lib/jvm/jdk1.7/bin/jar 300 # update -alternatives -- install/usr/bin/javah/usr/lib/jvm/jdk1.7/bin/javah 300 # update-alternatives -- install/usr/bin/javap/usr/ lib/jvm/jdk1.7/bin/javap 300

Then execute

# update-alternatives --config java
# update-alternatives --config javac
# update-alternatives

If JDK is installed for the first time, a prompt is displayed.

There is only one alternative in link group java (providing/usr/bin/java):/usr/lib/jvm/java/bin/java requires no configuration.

If it is not the first installation, you will be prompted to enter the JDK option serial number, and then enter your own jdk serial number.

5. Exit the Administrator permission and Test

# exit
$ java -versionjava version "1.7.0_65"Java(TM) SE Runtime Environment (build 1.7.0_65-b17)Java HotSpot(TM) Server VM (build 24.15-b04, mixed mode)

How to install JDK in ubuntu

Run the following command to install ubuntu:
Sudo apt-get install openjdk # openjdk is an open-source jdk package, which is compatible;
Sudo apt-get install sun-jdk # This is the linux version officially released by sun. Press the tab key when you enter sun-to view the related software packages.

How to install jdk in ubuntu 1204

Search for OpenJDK installation in the Software Center.
If you want to install the official JDK, you can download and install it on the official website. I personally think OpenJDK can fully meet your needs.

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.