Install Tomcat 7.0 and use it in Eclipse (Juno)July 20th, 2013 | Posted by in Eclipse | Java | Java EE | Tomcat
For this post I continue from where I left after installing JBoss in a previous article (Install JBoss and use it in Eclipse (Juno)). This is not a must though and it works in isolation, so you don’t need to look at the other one if you don’t need to.
Enough said, let’s start.
Go to the Tomcat website download page and scroll down where you can see the binaries ready to be downloaded:
I will downloaded the zip of the version 7.0.40:
Once the download completes, unzip its content in a reasonable location. I put mine in “C:\apache-tomcat-7.0.40″
Tomcat – Configure Windows
In order to been able to launch Tomcat in isolation, you need to configure at least one environment variable.
So let’s do this.
Open the computer properties. You can do this opening the Start menu and right-clicking on the “Computer” button and selecting “Properties”:
In the new window click on the Advanced system settings link in the right panel:
In the System Properties window select the “Advanced” tab and click the “Environment Variables…” button:
In the new window click “New…” below the “User variables” section (or you can use the System variable if you want this to be set for everyone):
A new window will pop-up and here you will have to add a variable “JAVA_HOME” that points to your data sdk:
Press Ok and Ok again in the previous window and it will be ready.
Tomcat – Test it
To test that everything is correctly configured let’s just do a quick test run.
Go where it is located and enter in the bin folder: C:\apache-tomcat-7.0.40\bin
Double click the “startup.bat” batch file. If windows asks you confirmation to trust the file click OK (deselect the checkbox “Always ask before opening this file” if you don’t want to see this popup every time you launch it).
You should see a console window coming up and stay on screen:
To see Tomcat at work now, open a browser and go to:
You should see something similar to this:
When you are happy you can then shut it down executing “shutdown.bat” from the same bin folder.
The console window should disappear and we can move to the next step :)
Tomcat – Adding the server to Eclipse
Open Eclipse and open the “Servers” tab. If you have trouble finding it, use the same steps explained in another post: Install JBoss and use it in Eclipse (Juno)
Once you find it:
Add a new server (right-click menu):
In the new window select the Apache folder and select the Tomcat version that you installed. It is the 7.0 in this case:
If this is the screen that you see then the only thing you can do is click Next.
If you end up in a workspace where tomcat was already configured, the chances are that you will see another screen that will allow you to jump directly to the completion of the task, just clicking on Finish:
In any case, if you didn’t see this screen and what you see is the previous one, then click Next and you will be prompted to insert some info that eclipse needs in order to been able to interact with the server. Note that this screen is the same one you would see if you click on “Add…” on the other screen I just shown above.
Here make sure you enter the path where you extracted the Tomcat zip file.
Before proceeding, ensure you select the JRE you want to use. In my case I already configured eclipse to use the Java EE SDK, so it is ok in this case just leave the option set to “Workbench default JRE”.
After clicking on Finish you will see the Tomcat server displayed in the servers tab:
Thanks for following and stay tuned for the next episode.