官术网_书友最值得收藏!

  • Hudson 3 Essentials
  • Lloyd H. Meinholz
  • 233字
  • 2021-07-21 18:00:10

Environment variables

An environment variable is a variable that stores a value that is used by an operating system or a process (application).

In this book, I will use Unix-style environment variables in examples. If you are using Windows, simply replace ${MY_VARIABLE} with %MY_VARIABLE%.

The method of setting environment variables is operating system dependent, but the format of creating and modifying environment variables is similar.

As an example, we will show how to add the JAVA_HOME environment variable on both Linux and Windows operating systems. This example assumes that the JDK has been installed to ${HOME}/jdk1.7.0_25 on Linux and to C:\jdk1.7.0_25 on Windows.

Note

These are not appropriate installation locations for production systems; they are just intended to be used for experimentation and prototyping.

To set the JAVA_HOME environment variable in a Linux system that uses the bash shell, add the following lines to the ${HOME}/.bashrc file:

export JAVA_HOME=${HOME}/jdk1.7.0_25
export PATH=${JAVA_HOME}/bin:${PATH}

To set the JAVA_HOME environment variable on a Windows system:

  1. Right-click on My Computer.
  2. Click on Properties.
  3. Click on the Advanced tab.
  4. Click on Environment Variables.
  5. Click on New to add a new variable name.
  6. Enter the name: JAVA_HOME.
  7. Enter the value: C:\jdk1.7.0_25.
  8. Select the path variable, and click on Edit.
  9. Add %JAVA_HOME%\bin to the beginning of the value.

Setting environment variables on the Mac OS X operating system is very similar to how this is done on the Linux operating system.

主站蜘蛛池模板: 德江县| 吉林省| 吉木萨尔县| 九江市| 林甸县| 瓮安县| 宁城县| 靖安县| 马山县| 浏阳市| 岫岩| 托克托县| 池州市| 定陶县| 武鸣县| 麟游县| 曲阳县| 辽源市| 临猗县| 逊克县| 密山市| 视频| 定西市| 灵台县| 兴业县| 陆良县| 巫山县| 永修县| 深州市| 福海县| 同心县| 望城县| 天祝| 水城县| 菏泽市| 阜城县| 株洲县| 岳普湖县| 寻乌县| 庄浪县| 赤壁市|