Ubuntu JAVA7 SDK environment variable configuration (RPM)

Source: Internet
Author: User

1. Go to Oracle website to download the Java7 SDK

Http://www.oracle.com/technetwork/java/javase/downloads/index.html

Here i download the latest java1.7.0_07

2. Unzip

Unzip the downloaded jdk-7u7-linux-i586.tar.gz and put it in the/USR/LIB/JVM folder. In general, there are no JVM folders under the/usr/lib folder and need to be created manually. The author uses the root Administrator account login (sudo passwd root), so it can be created directly under the Lib folder. If you are a non-root login, you can use the command:

mkdir /usr/lib//usr/lib/jvmmv xx/jdk-7u7-linux-i586.tar.gz. tar zxvf jdk-7u7-linux-i586.tar.gz

3. Modifying environment variables

In Terminal input:

Vim ~/.BASHRC

Vim command is not familiar with the Internet to find information, there are many

Then add the following code (I insert):

Export java_home=/usr/lib/jvm/java1.7.0_07
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH

Save Exit (ESC +: Wq) and enter the following command to take effect immediately

SOURCE ~/.BASHRC

The Ps:/etc/profile setting method is valid for all logged-in users. ~/.BASHRC is valid only for the current user.

The above two is a configuration file, the system will read the/etc/profile, and then read ~/.BASHRC. Different user ~/.BASHRC files can have different settings,

/etc/profile is a shared one, and only root can modify it. ~/.BASHRC has an additional overlay effect on the/etc/profile.


4. Testing

Enter command Java-version If the result is as follows, the installation is correct.

[Email protected]:~# java-version
Java Version "1.7.0_07"
Java (TM) SE Runtime Environment (build 1.7.0_07-B10)
Java HotSpot (TM) Server VM (build 23.3-b01, Mixed mode

Ubuntu JAVA7 SDK environment variable configuration (RPM)

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.