Mac下环境变量的设置(Java&Tomcat)

1.编辑.bash_profile输入入下文本,注意替换成你的路径

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home 

    export CATALINA_HOME=/usr/local/apache-tomcat-8.5.16
    export PATH=$PATH:$CATALINA_HOME/bin
    export SERVLET_JAR=$CATALINA_HOME/lib/servlet-api.jar
    export JSP_JAR=$CATALINA_HOME/lib/jsp-api.jar

    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$SERVLET_JAR:$JSP_JAR
    export PATH=$JAVA_HOME/bin:$CLASSPATH:$PATH:

2.使.bash_profile文件设置生效,输入如下命令

    source .bash_profile

你可能感兴趣的:(Mac下环境变量的设置(Java&Tomcat))