Tomcat
1. To the official Apache homepage, download the full tar.gz file package for MAC version. Unzip the copy to the/library directory and name Tomcat, and the other directories are available.
2, modify the directory permissions to the terminal input sudo chmod 755/library/tomcat/bin/*.sh 3, start Tomcat Press ENTER after the prompt for the password, please enter the administrator password. Then type and enter:
sudo sh startup.sh
The following prompt indicates that the installation and operation succeeded:
Password:
Using catalina_base:/library/apache-tomcat-8.0.23
Using Catalina_home:/library/apache-tomcat-8.0.23
Using Catalina_tmpdir:/library/apache-tomcat-8.0.23/temp
Using Jre_home:/library/java/javavirtualmachines/jdk1.8.0_45.jdk/contents/home
Using CLASSPATH:/library/apache-tomcat-8.0.23/bin/bootstrap.jar:/library/apache-tomcat-8.0.23/bin/ Tomcat-juli.jar
Tomcat started.
4. Open the browser and enter http://localhost:8080/
If you see Apache Tomcat after the carriage return, it means that Tomcat has been successfully run
5. Configuration
TomcatStartup script:
Use the text editor to add the following code:
#!/bin/bash
Case $ in
Start
sh/library/tomcat/bin/startup.sh
;;
Stop
sh/library/tomcat/bin/shutdown.sh
;;
Restart
sh/library/tomcat/bin/shutdown.sh
sh/library/tomcat/bin/startup.sh
;;
*)
echo "Usage:start|stop|restart"
;;
Esac
Exit 0
Save the file as Tomcat, lowercase with no suffix. Give File Execution permissions:
chmod 777 Tomcat 777 system default maximum permissions (read and write: )
。 Place this file in the path contained in the terminal, such as/usr/bin, and then simply enter Tomcat start and Tomcat stop in the terminal to enable Tomcat.
The shortcut commands are as follows:
1) Tomcat start
2) Tomcat stop
3) Tomcat restart
Jdk
xxxdemacbook-pro:~ XXX $ which Java
/usr/bin/java
Go to command line
CD ~touch. Bash_profilevi. Bash_profile
PS: If there is no. bash_profile file in the home directory, create a new
Enter the contents of the JDK variable configuration:
Cd/library not CD Library to see Java files
Export java_home=/library/java/javavirtualmachines/jdk1.7.0_45.jdk/contents/home #jdk安装路径 Export Path= $JAVA _ Home/bin: $PATH export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Input: Wq save.
To update a configuration file:
source. bash_profile
MAC Environment variables