Install java7 on Ubuntu Linux

Source: Internet
Author: User

Http://393799950.iteye.com/blog/1266623

After installing JDK 7 in Ubuntu for a long time, JDK 7 was successfully installed in Ubuntu. Now, I am able to settle down in my computer with peace of mind. Now I will summarize the installation tips:
1.
To install JDK 7, you need to pull the JDK binary file .. This simple, direct download on the Oracle official website can pull the http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html
PS: Pay attention to the system version selection. I found my system is x86 only after having struggled for a long time with the x64 JDK...

2
Access the tar.gz file...
Tar-xzf jdk-7-linux-i586.tar.gz

3
Next, move the extracted folder to the/usr/lib/JVM directory.
Before that, you must have root permissions Su-L and then enter the password of the root account, you also need to create a folder mkdir/usr/lib/JVM in the/usr/lib directory.
After completing these preparations, we can move the JDK file to the desired location.
MV jdk1.7.0/usr/lib/JVM
In order to facilitate the configuration of environment variables, we change the JDK file name, the general online JDK file changed to jdk-7-sun.
MV/usr/lib/JVM/jdk1.7.0/usr/lib/JVM/Java-7-sun

4
Configure Environment Variables
If Vim is installed on your machine, run Vim ~ /. Bashrc
If not, use gedit. Run gedit ~ /. Bashrc
Add the following content to the environment variable:

Export java_home =/usr/lib/JVM/Java-7-sun

Export jre_home =$ {java_home}/JRE

Export classpath =. :$ {java_home}/lib :$ {jre_home}/lib

Export path =$ {java_home}/bin: $ path

5

Save the environment variable, exit the editor, and enter the following command to make the environment variable take effect.

Source ~ /. Bashrc

You can run the Env command to check whether the environment variable is successfully set.

6

Configure the default program

Sudo Update-alternatives -- install/usr/bin/Java/usr/lib/JVM/Java-7-sun/bin/Java 300

Sudo Update-alternatives -- install/usr/bin/javac/usr/lib/JVM/Java-7-sun/bin/javac 300

Sudo Update-alternatives -- config Java

If another JDK is installed in your system, the system will prompt you to select JDK 7.

7

Run the following command to test the JDK version:

Java-version

If the result is the same as the following, your jdk7 configuration will be complete.

Java version "1.7.0" Java (TM) se Runtime Environment (build 1.7.0-b147) Java hotspot (TM) server VM (build 21.0-b17, mixed mode)

This article Reprinted from http://redallanlu.blog.163.com/blog/static/3854299620119715653771/

 

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.