Install the Apache Tomcat application server

Tutorial:

Install the Apache Tomcat application server

TheServerSide.com

Having the Java Development Kit is the prime requisite for any Java developer, but having a good application server is a close second. Without an application server to run on, server-side applications are pretty useless. The top choice for many Java developers is Apache Tomcat, which is a fairly lightweight open source application server built on the Java Servlet and JavaServer Pages (JSP) technologies. This five minute tutorial will guide you step by step through the process of downloading and installing Apache Tomcat and configuring it to work on your system. For your convenience, a written transcription of the video follows.

click here for a larger sized video


Hi, I’m Cameron McKenzie. I’m the author of Hibernate Made Easy” and “JSF Made Easy” and a number of other helpful Java guides. One of the things I wanted to do right now was step you through the installation of a Tomcat server. I’ve actually installed a JDK and I’ve installed my JDK to _jdk1.6 as you can see there. I’ve also set up the Java environment variable, JAVA_HOME. If I look here I can see that an environment variable of JAVA_HOME has been set up to point to JDK1.6. Sometimes it’s even good to just verify that by doing an echo %JAVA_HOME% at the command prompt and see that indeed it has been configured and set up to be _jdk1.6. With that done all I need to do is download and install an apache Tomcat server.

Now I can do that by going to tomcat.apache.org, going to the download page and seeing that I can actually download Tomcat version 6. I’m going to just download the zip file, so under 6.024 I have the core distribution. The zip file is really all that I need. It’s only about 6.2 Megs in size, fairly small. I’ve actually cheated a little bit and downloaded it previously. You can see 6330 [KB] is the size there. With that downloaded all I have to do is open it up, agree to the terms of WinZip. I’m just going to extract this right to my C drive. I’m just going to extra it directly to the root of C. When I come back and look at my C drive I will have this folder apache-tomcat-6.024.

One of the things I like to do is to change it a little bit. I’m going to rename that folder. I’m going to rename it to _tomcat. That will make it easier to find. Notice it’s right up there, right after my [JDK]. It makes it a lot easier to find when you actually go into the command prompt and have to navigate to it as well. In Tomcat I have the bin directory there and inside the bin directory I’ve got that Startup.batch file. In order to actually test out my Tomcat installation, I’m just going to move to the bin directory of the Tomcat server. cd _tom* will get me into the Tomcat directory, move into the bin directory and just simply type in “startup” and that will trigger the corresponding batch file to run. You’ll see this little window startup here. That’s Tomcat starting and there we go, in 1905 [ms] everything seems to have started up fairly quickly. That’s fantastic because I just did the download seconds ago.

With the Tomcat server started the next thing to do is go to http://localhost:8080. I think if you actually look in here this is the log file actually being spit out in the Tomcat console. You’ll see that it’s all running on http port 8080. I go to http://localhost:8080, go into my Tomcat, go into my Web browser and all of a sudden I can see that indeed a Web page is coming up. It looks like Tomcat is running. Take a look at the status; everything seems to be working properly. I’m not actually going to log in but I am pretty happy that Tomcat is installed.

Now, with Tomcat started you can always go in and shut it down. It’s a pretty easy way to bounce the server and you notice that other window closes. And if I want to actually deploy applications, there is a little folder called “Web apps,” all I have to do is place a war file in here and it will automatically get deployed. It’s all pretty easy.

That is Tomcat installed along with the JDK, with that installed the next thing to do is actually start doing some development whether it be Hibernate or JSF or just basic servlet and JSP programming. Have fun.

17 Feb 2012