Question:
How to use apache tomcat? Help Please!?
answer it!
2008-03-07 08:13:05 UTC
I've successfully downloaded apache tomcat. Now I am a newbie..so I dont know how to use this to show my web pages.
My program is stored in c:/programfiles/apachexxx
and my folder which has html/php filesis in desktop at the moment. can someone tell me how to get this files up and running so i cn test them everytime i make updates and add codes into it.

Thanks
Three answers:
Syed
2008-03-07 08:19:41 UTC
Follow these steps:

Install the JDK. Make sure JDK 1.5 or 1.6 is installed and your PATH is set so that both "java -version" and "javac -help" give a result.

Configure Tomcat.

Download the software. Go to http://tomcat.apache.org/download-60.cgi and download and unpack the zip file for the current release build of Tomcat 6.0.

Set the JAVA_HOME variable. Set it to refer to the base JDK directory, not the bin subdirectory.

Change the port to 80. Edit install_dir/conf/server.xml and change the port attribute of the Connector element from 8080 to 80.

Turn on servlet reloading. Edit install_dir/conf/context.xml and change to .

Enable the invoker servlet. Go to install_dir/conf/web.xml and uncomment the servlet and servlet-mapping elements that map the invoker servlet to /servlet/*.

Turn on directory listings. Go to install_dir/conf/web.xml, find the init-param entry for listings, and change the value from false to true.

Set the CATALINA_HOME variable. Optionally, set CATALINA_HOME to refer to the top-level Tomcat installation directory. Not necessary unless you copy the startup scripts instead of making shortcuts to them.

Use a preconfigured Tomcat version. Optionally, use a version of Jakarta Tomcat that has all of the above changes already made, and has the test HTML, JSP, and servlet files already bundled. Just unzip the file, set your JAVA_HOME and CLASSPATH variables, and you are ready to go.

Test the server.

Verify that you can start the server. Double-click install_dir/bin/startup.bat and try accessing http://localhost/.

Check that you can access your own HTML & JSP pages. Drop some simple HTML and JSP pages into install_dir/webapps/ROOT and access them with http://localhost/filename.

Try Compiling and Deploying Servlets.

Set up your development environment.

Create a development directory. Put it anywhere except within the Tomcat installation hierarchy.

Make shortcuts to the Tomcat startup & shutdown Scripts. Put shortcuts to install_dir/bin/startup.bat and install_dir/bin/shutdown.bat in your development directory and/or on your desktop.

Set your class path. Use the CLASSPATH environment variable or set the path in the project settings of your IDE. Include the current directory ("."), the servlet/JSP JAR files (install_dir/lib/servlet-api.jar, and install_dir/lib/jsp-api.jar, and install_dir/lib/el-api.jar), and your main development directory from Step 1.

Bookmark the servlet & JSP javadocs. Add the servlet 2.4 API and the JSP 2.0 API to your bookmarks/favorites list.

Compile and test some simple servlets.

Test a packageless servlet. Compile a simple servlet, put the .class file in install_dir/webapps/ROOT/WEB-INF/classes, and access it with http://localhost/servlet/ServletName.

Test a servlet that uses packages. Compile the servlet, put the .class file in install_dir/webapps/ROOT/WEB-INF/classes/packageName, and access it with http://localhost/servlet/packageName.ServletName.

Test a servlet that uses packages and utility classes. Compile a servlet, put both the servlet .class file and the utility file .class file in install_dir/webapps/ROOT/WEB-INF/classes/packageName, and access the servlet with http://localhost/servlet/packageName.ServletName. This third step verifies that the CLASSPATH includes the top level of your development directory.

Establish a simplified deployment method.

Copy to a shortcut. Make a shortcut to install_dir/webapps/ROOT. Copy packageless .class files directly there. With packages, copy the entire directory there. This is the simplest option for beginners, and the preconfigured Tomcat version already has a development directory with these shortcuts.

Use the -d option of javac. Use -d to tell Java where the deployment directory is.

Let your IDE take care of deployment. Tell your IDE (Eclipse, NetBeans, JBuilder, etc.) where the deployment directory is and let it copy the necessary files.

Use ant or a similar tool. Use the Apache make-like tool to automate copying of files.
?
2016-05-26 14:26:08 UTC
Apache is the open source web server that runs on almost all platforms. Tomcat or Jakarta Tomcat is the Java servlet container that allows it to run Java servlets or jsp.
David D
2008-03-07 08:17:24 UTC
Tomcat is for running JSPs and Servelets, for PHP you need Apache HTTPD, not Apache Tomcat.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...