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