Install Eclipse + Tomcat + MySQL in Linux to configure the J2EE development environment
1. Version Information
(1) 64-bit CentOS 6.4 release, uname-a is shown as follows:
Linux localhost. localdomain 3.11.6 #1 SMP Sat Nov 2 23:25:40 KST 2013 x86_64 x86_64 x86_64 GNU/Linux
(2) Eclipse: Version: Kepler Service Release 2
(3) Tomcat: apache-tomcat-7.0.53
(4) Mysql: mysql-server-5.1.73
(5) JDBC driver: mysql-connector-java-5.1.30
2. Install software (most operations require root or sudo permissions)
(1) install Eclipse. See the previous article "manual installation of Eclipse in Linux Shell environment" ()
(2) install Tomcat. For more information, see configuring Tomcat in Linux and allowing users to manage services with specified identities ().
Note: When installing JDK, you do not need to set the environment variable (JAVA_HOME, PATH, CLASSPATH) according to the correct method.
Install and configure the J2EE environment
Introduction to the MVC model in J2EE
Build a J2EE environment in Linux
Build a J2EE development environment
(3) install Mysql by using the built-in installation kit. After installing yum install mysql-*, use rpm-qa | grep mysql to include all the following components.
Mysql-server-5.1.73-3.el6_5.x86_64
Mysql-libs-5.1.73-3.el6_5.x86_64
Mysql-5.1.73-3.el6_5.x86_64
Mysql-devel-5.1.73-3.el6_5.x86_64
(4) install JDBC driver
Http://dev.mysql.com/downloads/file.php? Id = 451546
After the tar-xvzf mysql-connector-java-5.1.30.tar.gz is executed, copy the jar files to the tomcat library.
Cp mysql-connector-java-5.1.30-bin.jar/opt/tomcat7/lib/
Note: You can also copy the jar file to the lib of a specific project for use only for a specific project.
3. configuration method (most operations require root or sudo permissions)
(1) create a mysql database and authorize the specified user.
Mysqladmin-u root-p create DB_NAME
Grant <privilege> on DB_NAME to <user> [identified by user-password] [with grant option];
(2) modify the Tomcat configuration file
Find the tomcat/conf/context. xml file in the tomcat installation directory, and add the following statement to vi context. xml.
<Resource name = "jdbc/mysql" auth = "Container" type = "javax. SQL. dataSource "maxActive =" 20 "maxIdle =" 10 "maxWait =" 5000 "username =" db_username "password =" db_userpw "driverClassName =" com. mysql. jdbc. driver "url =" jdbc: mysql: // localhost/DB_NAME "/>
Note: If the mysql server port is not the default port, add port_no to the URL of the database.
(3) Open eclipse and add the tomcat server. After adding the server, you can use the tomcat server.
For more details, please continue to read the highlights on the next page: