Linux-Environment variables

Source: Internet
Author: User

Overview

An environment variable can be understood as a set of parameters for a system or user application;

The path variable tells the system which directories to look for when running a program without specifying the full path, in addition to looking for the program under the current directory;

The CLASSPATH variable is to tell the Java Runtime environment where the required classes or packages (such as *.jar files) can be found.

View environment variables

# Use the following commands to view Echo $PATH Env Set

Modify environment variables (to add Java environment variables as an example)

Way One

# Effective Method: Immediate effect # Impact range: Only Current user # Expiration: Temporary change, valid only in the current terminal window export path=/usr/local/java/jdk1.7.0_45/bin: $PATH

Way Two

# Modify the BASHRC file ~/in the home directory of the personal user . BASHRC
# Add the following script at the end
Path=/usr/local/java/jdk1.7.0_45/bin: $PATH
# Execute the following script to make it effective immediately, or close the current terminal window, reopen the new terminal window, or take effect
SOURCE ~/.BASHRC

# Impact Range: Current user only
# expiry date: Permanently valid

Mode three

# Modify/etc/ profile file/etc/profiles 
# Locate the location where the path variable is set, modify the export path =/usr/local/java/jdk1 as following script. 7. 0_45/Bin: $PATH
# Execute the following script to take effect immediately, or reboot the system to take effect
/etc/profile


# expiry date: Permanently valid

Mode Four

# Modify/etc/ environment File /etc/Environment# Add the following script/usr/local/java/jdk1 in the PATH variable  . 7. 0_45/Bin# Effective Method: Reboot system # Impact range: All users # Expiration: Permanent 

Linux-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.