Now more and more friends using Linux, development under Linux is the first need to configure environment variables, the following three examples of configuration java environment variables The method of the environment variable.
1. Modify the /etc/profile file
This method is recommended if your computer is only used for development, because all users have the right to use the shell. These environment variables can cause security problems in the system.
(1) Open /etc/profile with a text editor
(2) Add at the end of the profile:
JAVA_HOME=/usr/share/jdk1.5.0_05
PATH=JAVA H OME/bin: PATH
CLASSPATH=.:JAVA H OME/lib/dt.jar: JAVA_HOME/lib /tools.jar
export JAVA_HOME
export PATH
export CLASSPATH
(3) Re-login
Annotation:
a. You should change /usr/share/jdk1.5.0_05jdk to your jdk installation directory
b. Linux uses the colon ":" to separate the path
c. PATH/CLASSPATH /$JAVA_HOME is used to reference the value of the original environment variable, especially when setting environment variables Note that the original value cannot be overwritten. This is a common mistake.
d. The current directory in the CLASSPATH “.” can not be dropped, the current directory is also a common mistake.
e. export is to export these three variables as global variables.
f. Cases must be strictly distinguished.
2. Modifying the .bashrc file
This method is more secure, it can control the permissions of using these environment variables to the user level, if you need to give User permissions use these environment variables, you only need to modify the .bashrc file in their personal user's home directory.
(1) Open the .bashrc file in the user directory with a text editor
(2) Add at the end of the .bashrc file: < Br>
set JAVA_HOME=/usr/share/jdk1.5.0_05
export JAVA_HOME
set PATH=JAVA H OME/bin: PATH
export PATH < Br>
set CLASSPATH=.:JAVA H OME/lib/dt.jar: JAVA_HOME/lib/tools.jar
export CLASSPATH
(3) Re-login
3. Setting variables directly in the shell
This method is deprecated, because changing the shell, your settings are invalid, so this method It is only temporary use, and it needs to be reset when it is used later. It is more troublesome.
Execute the following commands in the shell terminal:
export JAVA_HOME=/usr/share/jdk1.5.0_05
export PATH=JAVA H OME/bin: PATH
export CLASSPATH=.:JAVA H OME/lib/dt.jar: JAVA_HOME/lib/tools.jar
There is no doubt that Red Hat is indeed the choice of many companies considering Linux, but in rece
CentOS(Community Enterprise Operating System) is an open source Operating system. It is almost simil
tcpdump is a commonly used capture tool under the Linux command line, record the usual way, the test
A.Linux files can be divided into four types: ordinary files, directory files, link files, and devi
Webalizer Chinese help file noun explanation
Fedora pan0, virbr0 uninstall tutorial
Ordinary users under Linux can not directly use crontab problem
Linux read-write lock implementation tutorial
Linux signal signal processing mechanism
Batch replacement of file contents under Linux system
The meaning of X-Cache and X-Cache-Lookup in Squid
Linux Chinese garbled solution
Linux operating system boot record backup and recovery method
Win XP folder permissions settings
What should I do with win10 edge garbled?
Set encrypted partitions for flash on Windows 7
How to open SNMP protocol port 161 under Win7 Ghost pure system?
How to solve XP can't access Win7 shared files
How to troubleshoot and reset the Windows 8 function
Windows 7 system often uses black screen or prompts unexpected shutdown
Win8.1 IE11 browser how to add a website favorite commonly used website
Win10 technology preview version of the first entry essential tips
Windows2003 64-bit registration code Serial number Activation code