permaculture playing cards
The moose likes IDEs, Version Control and other tools and the fly likes question about Eclipse and running on Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "question about Eclipse and running on Tomcat" Watch "question about Eclipse and running on Tomcat" New topic

question about Eclipse and running on Tomcat

Jay Dilla
Ranch Hand

Joined: Aug 12, 2004
Posts: 201
Do I have to set up the configuration in order to run JSP files on the Tomcat server?
I thought I could just do localhost:8080/folder/file.jsp
but that is not working.
I know you can also run it thru your eclipse by right clicking the JSP file and selecting run on server
how do i set it up to do either, and which is the proper way to publish jsp/html files to the web?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

Once long ago you could do something like that, but it was a major security risk, so it's turned off by default these days. You're better off setting up a formal web application in WAR format. A simple way to deploy a WAR is to drop a copy of the WAR file in the TOMCAT_HOME/webapps directory. In the Tomcat 5.0 releases (should include more recent Tomcats, too), the WAR file will be unpacked into a directory having the same name as the basename of the WAR file. Assuming there's not already one there, in which case you should first delete the old webapp directory.

Simple does not equal recommended - for "proper" ways to deploy webapps in Tomcat, I recommend you study the Tomcat docs. But the simple way will get you going until you learn better ways.

Regarding your question of how to publish JSPs and HTML pages, the answer is that you build a WAR file containing the JSPs, HTML, CSS, images, Java code and whatever other resources the webapp will need, then deploy the WAR to your Tomcat (or other webapp) server. a WAR (or Web ARchive) is a ZIP file with a specifically-designed structure. Full details are too lengthy to go into here - get a good book on Java web application development.

The "Run on server" option is a rather specialized feature involving remote application deployment. I've never used it. Eclipse does not come with a builtin webapp server - neither Tomcat nor any other webapp server. Instead you have to install a webapp support plugin into Eclipse. I use the sysdeo Tomcat plugin, which allows Eclipse to start up a copy of an externally-installed Tomcat and debug applications running in that copy of Tomcat. There are several other plugins that can do similar things.

An IDE is no substitute for an Intelligent Developer.
Sunil Vasudevan
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
You need Web Tools platform plugins with Eclipse to do a right click and run Servlets/JSPs etc on server.

Check this website:

Sunil.V<br />SCJP2, SCWCD1.4, SCBCD1.3
I agree. Here's the link:
subject: question about Eclipse and running on Tomcat
It's not a secret anymore!