File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes tomcat port Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat port " Watch "tomcat port " New topic

tomcat port

shobhit garg
Ranch Hand

Joined: Mar 07, 2004
Posts: 42
Hi ,
How can we programatically decide on which port to run tomcat.
I don't want to modify the server.xml but want to do it through
java code .

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Tomcat binds to the port specified in server.xml when it starts up.
Webapplications are not loaded until Tomcat has started.

This means that it is not possible to change this setting from within your webapp.

Tomcat is an open source project so you are free to download and modify the actual Tomcat source code if you want to change it's default behavior.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: tomcat port
It's not a secret anymore!