Linux configuration java (JDK) environment variables

Source: Internet
Author: User

this post was last edited by Zhai on 2013-11-19 23:00

1. Download the JDK
Oracle Official: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Linux 32bit Download jdk-7u-linux-i586.tar.gz
Linux 64bit Download jdk-7u-linux-x64.tar.gz


2. Unzip the JDK

    1. Tar xzvf jdk-7u-linux-i586.tar.gz
Copy Codeor tar xzvf jdk-7u-linux-x64.tar.gz
3. Setting Environment variables
The Linux global variable is set in the/etc/profile file, and the variable in the file takes effect for all users
Linux User variables are set at ~/.bash_profile
This article is set to Global, and the Java_home,classpath variable is set in the/etc/profile file
    1. sudo vi/etc/profile
Copy CodePress I to enter insert mode, the cursor moves to the end of the file, add the following:
  1. Export java_home=/usr/local/java/jdk1.7.0_21
  2. Export classpath=.: $JAVA _home/lib: $CLASSPATH
  3. Export path= $JAVA _home/bin: $PATH
Copy CodePress ESC, enter: Wq save
4. Whether the test environment variable is in effect
    1. source/etc/profile
    2. java-version
Copy CodeDisplay Java information such as:

Linux configuration java (JDK) environment variables

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.