Install Java 7 in ubuntu12.04

Source: Internet
Author: User

Java environment Configuration

This is only the process of installing EXE in windows. It is not too complex in Ubuntu. Generally, I understand the Java environment configuration and the following steps:

 

1. download the new JDK file from the official Oracle website, put the downloaded file in/usr/lib/JVM/Java, and decompress it. OK. JDK has been installed!

2. environment variable configuration

Run the following command on the terminal: sudo VI/etc/environment. The red part shows the added information:

Javahome =/usr/lib/JVM/Java/jdk1.7.0 _ 04

Path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/lib/JVM/Java/jdk1.7.0 _ 04/bin:/usr/lib/JVM/Java/jdk1.7.0 _ 04/JRE/bin"

Classpath =/usr/lib/JVM/Java/jdk1.7.0 _ 04/lib:/usr/lib/JVM/Java/jdk1.7.0 _ 04/JRE/lib

Next, set the default JDK, because the system may have another JDK by default.

Run the following command on the terminal:

Sudo Update-alternatives -- install/usr/bin/Java/usr/lib/JVM/Java/jdk1.7.0 _ 04/bin/Java 300

Sudo Update-alternatives -- install/usr/bin/javac/usr/lib/JVM/Java/jdk1.7.0 _ 04/bin/javac 300

Select the system's default JDK and run the following command on the terminal: sudo Update-alternatives -- config Java

If only one Java environment exists, the system prompts that only one JDK exists.

Finally, execute the command: Java-version

Java version "1.7.0 _ 04"

Java (TM) se Runtime Environment (build 1.7.0-b04)

Java hotspot (TM) Client VM (build 15.2-b04, mixed mode, sharing)

The following shows that the java used is Sun's Java, OK, and the environment variable is set successfully.

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.