CSIS 626 Project: Installation Instructions
The student scheduler application requires the following tools to be installed:
- Java Software Development Kit (SDK)
- MySQL server
- JDBC for MySQL
- Apache Tomcat Server
After installation, proceed to Populating the Database for instructions on populating the database with the required data.
Then proceed to Rev 4.0 for the current final working version which contains the code and instructions for running the program.
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
- For Windows XP: Right Click on My Computer -> Properties -> Advanced -> Environment Variables. Edit the Path to include c:\mysql\bin
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)
Securing MySQL server
(The default privileges on Windows give all local users full privileges to all databases without specifying a password.)
- At Command Prompt
C:\mysql\bin>mysql mysql
mysql> DELETE FROM user WHERE Host='localhost' AND User='';
mysql> FLUSH PRIVILEGES;
mysql> GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
mysql> QUIT
C:\mysql\bin>mysqladmin -u root password your_password
- After you've set the password, if you want to shut down the mysqld server, you can do so using this command:
C:\mysql\bin>mysqladmin -u root --password=your_pasword shutdown
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
Don't forget to start the MySQL server!
- 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\csis626
- Save date.jsp into that directory
- Create folder C:\jakarta-tomcat-5.0.19\webapps\csis626\WEB-INF
- Save web.xml into that directory
- Create folder C:\jakarta-tomcat-5.0.19\webapps\csis626\WEB-INF\classes
- Start Tomcat
- Point your browser to http://localhost:8080/csis626/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/csis626 to hold source and class files.
- Place the declaration
package csis626;
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 csis626/*.java
- When referencing a bean in a JSP page, use the fully qualified class name, for example
<jsp:useBean id="zone" class="csis626.TimeZoneBean" scope="session"/>
- To compile servlets, add .../common/lib/servlet.jar to your class path.