CSIS 541 Project: Installation Instructions
Installing MySQL
- Go to http://dev.mysql.com/downloads/index.html
- Under MySQL database server & standard clients:
Download MySQL 4.0 (mysql-4.0.18-win.zip)
- Unzip mysql-4.0.18-win.zip and run Setup.exe
- Install for Typical
- Copy C:\mysql\my-small.cnf and rename to C:\my.cnf
Starting MySQL server
- At Command Prompt
C:\mysql\bin>mysqld --console
Stopping MySQL server
- At Command Prompt
C:\mysql\bin>mysqldadmin -u root shutdown
Starting MySQL command line tool
- At Command Prompt
C:\mysql\bin>mysql test
(where test is the name of the database)
Installing JDBC for MySQL
- Go to http://dev.mysql.com/downloads/index.html
- Under MySQL Connector/J -- for connecting to MySQL from Java
Download MySQL Connector/J 3.0 (mysql-connector-java-3.0.11-stable.zip)
- Create folder C:\JDBC
- Unzip and extract all files to C:\JDBC
- Copy
C:\JDBC\mysql-connector-java-3.0.11-stable\mysql-connector-java-3.0.11-stable-bin.jar
to
C:\Sun\jdk\jre\lib\ext\
Testing that all this works
- Save these files into your Java work directory;
TestDB.java SimpleDataSource.java database.properties
- Compile for TestDB.java
- At Command Prompt
C:\JavaPrograms>java TestDB database.properties
- The output should show one line of output "Romeo"
Installing Apache TomCat Server
- Go to http://jakarta.apache.org/site/binindex.cgi
- Scroll down and under Tomcat 5.0.19, download 5.0.19zip
- Unzip into C:\
- From Desktop, Right Click on My Computer and select Properties
- Click on the Advanced Tab and then click on Environment Variables
- If a JAVA_HOME variable does not exist create one with the value set to the Java JDK path (e.g., C:\Sun\AppServer\jdk)
Starting up Tomcat 5
- At Command Prompt
C:\jakarta-tomcat-5.0.19\bin>startup
- After startup, the default web applications included with Tomcat 5 will be available by visiting: http://localhost:8080/
Shutting down Tomcat 5
- At Command Prompt
C:\jakarta-tomcat-5.0.19\bin>shutdown
Testing our Java applications on Tomcat
- Ensure the web server is shut down
- Create folder C:\jakarta-tomcat-5.0.19\webapps\searchengine
- Save date.jsp into that directory
- Create folder C:\jakarta-tomcat-5.0.19\webapps\searchengine\WEB-INF
- Save web.xml into that directory
- Create folder C:\jakarta-tomcat-5.0.19\webapps\searchengine\WEB-INF\classes
- Start Tomcat
- Point your browser to http://localhost:8080/searchengine/date.jsp
- The current date and time should be displayed
IMPORTANT NOTE REGARDING PACKAGES
Tomcat 5 does not let you place beans into the default package. Instead, you need to place each bean into a named package. Follow this procedure:
- Make a subdirectory WEB-INF/classes/searchengine to hold source and class files.
- Place the declaration
package searchengine;
as the first line of each source file
- Compile the files as follows:
- Change to the base directory WEB-INF/classes
- Run the command javac searchengine/*.java
- When referencing a bean in a JSP page, use the fully qualified class name, for example
<jsp:useBean id="zone" class="searchengine.TimeZoneBean" scope="session"/>
- To compile servlets, add .../common/lib/servlet.jar to your class path.