This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Is it possible to run Tomcat from dos prompt if Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Is it possible to run Tomcat from dos prompt if" Watch "Is it possible to run Tomcat from dos prompt if" New topic
Author

Is it possible to run Tomcat from dos prompt if

Jay Dilla
Ranch Hand

Joined: Aug 12, 2004
Posts: 201
you have NetBeans and Eclipse installed and running?
I'm trying to learn JSPs and Servlets from the Head First book but I'm having ALOT of trouble getting the tomcat to start up.
I don't want to change the Path but I think I have to in order to access the tomcat from dos prompt.
Any work around for this?
I want to keep my netbeans/eclipse configuration the same but maybe set up another tomcat to practice the examples in the book using dos prompt.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It is and (in my humble opinon) it's a good idea.
I've never liked the idea of learning servlet programming in an IDE.

In order to have two copies of Tomcat running on the same machine, you need to change a couple port numbers. If everything in Netbeans is happy, don't disturb it.

Download the ".zip" version of Tomcat (assuming you're on a Windows machine) and unpack it. We'll call the directory it creates 'tomcat' (as apposed to apache-tomcat-5.5.blah blah..).
Open up tomcat/conf/server.xml and change the non-secure connector port from 8080 to something else like 8081.
Then, change the SHUTDOWN port from 8005 to something like 8006.

What you change them to is not really that important as long as nothing else is already using those ports.

Now, when you start up this version of Tomcat, you'll access it with:
http://localhost:8081


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jay Dilla
Ranch Hand

Joined: Aug 12, 2004
Posts: 201
Originally posted by Ben Souther:
It is and (in my humble opinon) it's a good idea.
I've never liked the idea of learning servlet programming in an IDE.

In order to have two copies of Tomcat running on the same machine, you need to change a couple port numbers. If everything in Netbeans is happy, don't disturb it.

Download the ".zip" version of Tomcat (assuming you're on a Windows machine) and unpack it. We'll call the directory it creates 'tomcat' (as apposed to apache-tomcat-5.5.blah blah..).
Open up tomcat/conf/server.xml and change the non-secure connector port from 8080 to something else like 8081.
Then, change the SHUTDOWN port from 8005 to something like 8006.

What you change them to is not really that important as long as nothing else is already using those ports.

Now, when you start up this version of Tomcat, you'll access it with:
http://localhost:8081


so i don't have to touch the path at all?
won't i get "bin isn't recognized as internal or external command"?
when i was trying to do bin/startup.sh it wouldn't work
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You would still need to follow the instructions for installing and running Tomcat from the command line.

To make life easier, you could just install the '.exe' version and just start it from the Window,s Start menu (or as a Window's service). You would still want to change the ports in server.xml if you want to run both instances at the same time.
Jay Dilla
Ranch Hand

Joined: Aug 12, 2004
Posts: 201
Originally posted by Ben Souther:
You would still need to follow the instructions for installing and running Tomcat from the command line.

To make life easier, you could just install the '.exe' version and just start it from the Window,s Start menu (or as a Window's service). You would still want to change the ports in server.xml if you want to run both instances at the same time.



i'm not sure if you answered the question about setting the path. will the exe file automatically set the path for me? and if so wouldn't it overwrite the path set for my IDEs?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Jay Dilla:



i'm not sure if you answered the question about setting the path. will the exe file automatically set the path for me? and if so wouldn't it overwrite the path set for my IDEs?


The exe version doesn't rely on environment variables like PATH.
It saves its settings in the Window's registry.
It does use the JAVA_HOME environment variable (if set) as a hint when looking for your JDK but you can also browse for the JDK you want to use during the installation wizard.


Another approach (one that I use on Linux boxes all the time) is to put the environment settings inside the catalina.bat or (sh) file so the environment only exists for that copy of Tomcat.

For instance, on my machine I'm running Tomcat 5.5 with JDK 1.5 for maintaining our current version but for our upcoming release, we're developing on Tomcat 6 with JDK 1.6

To do this, I add all the export (set on Windows) commands to the top of catalina.sh (.bat on Windows). This way, I can have two copies of Tomcat running with different JDKs at the same time.
Jay Dilla
Ranch Hand

Joined: Aug 12, 2004
Posts: 201
thanks i'll do this when i get home
Jay Dilla
Ranch Hand

Joined: Aug 12, 2004
Posts: 201
Originally posted by Ben Souther:
You would still need to follow the instructions for installing and running Tomcat from the command line.

To make life easier, you could just install the '.exe' version and just start it from the Window,s Start menu (or as a Window's service). You would still want to change the ports in server.xml if you want to run both instances at the same time.


where can I find this server.xml?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Read the Tomcat documentation.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible to run Tomcat from dos prompt if
 
Similar Threads
Confused with Netbeans
problem with serverGUI
Difficulty in understanding the the way the code is compiled in the book
TOMCAT ON WINDOWS NT
How to Start Tomcat in Eclipse?