1. 下载JDK: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u32-downloads-1594644.html ,并安装
2. 下载Tomcat: http://apache.etoak.com/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.exe ,并安装
3. 配置JDK PATH:
JAVA_HOME: D:\Program Files\java\jdk1.6.0_32
classpath: .;%JAVA_HOME%\lib\dr.jar;%JAVA_HOME%\lib\tools.jar;
path: ;%JAVA_HOME%\bin
4. 配置Tomcat PATH:
CATALINA_BASE: D:\Tomcat6
CATALINA_HOME: D:\Tomcat6
TOMCAT_HOME: D:\Tomcat6
classpath: ;%CATALINA_HOME%\lib\servlet-api.jar;
5. 启动Tomcat
6. 创建文件夹:D:\Tomcat 6.0\webapps\myapps\WEB-INF以及文件web.xml并写入以下内容:
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>My Web Application</display-name> <description> A application for test. </description> </web-app>
7. 创建文件:D:\Tomcat 6.0\webapps\myapps\index.jsp,并写入以下内容:
<html> <body> <center> Now time is <%=new java.util.Date()%> </center> </body> </html>
8. 执行: http://localhost:8080/myapps/ 看到时间打印出来,大功告成!