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

Updating PATH

Unix-like operating systems (Windows, too) use the concept of a PATH to search for binaries (or executables, in the case of Windows). The PATH is nothing more than a list of folders separated by the colon character ':' that tells the operating system where to look for binaries.

To add something to your PATH (and make it a permanent change), you need to edit either the .bash_profile (macOS) or .bashrc (Linux) files; these are located in the root folder for your user. Thus, to add both Scala and Maven binaries to the PATH, you can do the following (on macOS):

cp ~/.bash_profile ~/.bash_profile_old   # make a copy just in case
echo export SCALA_HOME=/opt/scala >> ~/.bash_profile
echo export MAVEN_HOME=/opt/apache-maven >> ~/.bash_profile
echo PATH=$SCALA_HOME/bin:$MAVEN_HOME/bin:$PATH >> ~/.bash_profile

On Linux, the equivalent looks as follows:

cp ~/.bashrc ~/.bashrc_old   # make a copy just in case
echo export SCALA_HOME=/opt/scala >> ~/.bashrc
echo export MAVEN_HOME=/opt/apache-maven >> ~/.bashrc
echo PATH=$SCALA_HOME/bin:$MAVEN_HOME/bin:$PATH >> ~/.bashrc

The preceding commands simply append to the end of either of the .bash_profile or .bashrc files using the redirection operator >>.

Once you execute the preceding commands, restart your Terminal, and:

echo $PATH

It should now include paths to both the Scala and Maven binaries.

主站蜘蛛池模板: 汪清县| 修文县| 晋宁县| 古交市| 罗城| 河津市| 根河市| 阜新| 资源县| 安多县| 垦利县| 三明市| 德化县| 通辽市| 湟源县| 全州县| 河津市| 遂溪县| 繁昌县| 湄潭县| 吉首市| 高要市| 凤山市| 会东县| 原阳县| 广昌县| 科尔| 兰西县| 武宁县| 台安县| 重庆市| 新巴尔虎左旗| 临泉县| 喀喇| 巴青县| 施甸县| 大荔县| 清涧县| 横山县| 宜川县| 亚东县|