-1

I have Eclipse with tomcat running a dynamic web project.

Since I need to run also other softwares and my computer is not so strong, I would like to start my servlet (essientially Eclipse's tomcat config) without eclipse running.

If I open the folder where I installed tomcat - I don't see the dynamic web project that I created via eclipse so running this instance wouldn't run my project

How can I start Tomcat with the same built classes (etc.) as when I start Tomcat from Eclipse?

EDITED

Well, I got a down vote but I don't understand why. I don't want to export it to WAR. As it's time consuming and I may need to change the code - but when I make the calls to tomcat to my REST project, I would like Eclipse not to be running.

Menelaos
  • 23,508
  • 18
  • 90
  • 155
Dejell
  • 13,947
  • 40
  • 146
  • 229

3 Answers3

2

Using Deployed War

You should execute a separate tomcat and deploy your web application there to the web-app directory.

Then you will not need to run tomcat through eclipse.

1) Run your tomcat through catalina start. 2) Deploy your war in webapps.

Changing Location that Eclipse Started Tomcat Uses

You can go to your servers view in eclipse. You should change your settings in "Server Locations". See https://stackoverflow.com/a/14105487/1688441

Then Tomcat from eclipse will be using the same directory as Tomcat outside of eclipse.

Community
  • 1
  • 1
Menelaos
  • 23,508
  • 18
  • 90
  • 155
  • It's not all that time consuming..you can export your WAR directly into your tomcat webapps directory. The other thing you could do is create a BAT file that copies the BUILT classes from your build folder to your tomcat webapps/"ServletName" folder. – Menelaos Apr 11 '13 at 12:12
  • What do you mean by you can export your WAR directly? can I tell eclipse to use that tomcat instance? – Dejell Apr 11 '13 at 12:26
  • let me clarify something. The only thing that changes is the directories that tomcat looks at for webapps when running from eclipse. The exact same exe is used. Have a look at: http://www.coderanch.com/t/87082/Tomcat/Configure-Tomcat-serve-applications-default . You need to find the directory eclipse executed tomcat uses - essentially where the built .classes and other files are stored when tomcat is executed from eclipse. I'll try to find that and give you more info. – Menelaos Apr 11 '13 at 12:34
  • Thanks. Can you upvote my question? I don't understand why was it downvoted? – Dejell Apr 11 '13 at 13:00
1

When you use the Eclipse its create a work directory. When you run the project the it deploy your application on the tomcat directory.

If you want run outside eclipse you can export your web project and do the deploy manually on the tomcat directory.

vanz
  • 319
  • 1
  • 2
  • 12
  • See my edited question. I prefer not to generate a war. How do I run this deploy project on my tomcat? under the regular location of tomcat I don't see the deployed project – Dejell Apr 11 '13 at 11:57
1
  1. Export the application to a .war file (right-click in eclipse -> export -> to .WAR file or use a ant script)
  2. Put the .war file in /webapps
  3. run startup.bat inside the /bin folder
John Snow
  • 5,214
  • 4
  • 37
  • 44
  • It would be possible to create a build script that builds the content of your WebContent folder (inside the project) along with the compiled java classes. This is exactly what a .WAR file contains and that is needed in order to run it on the tomcat server. The script can be configured to build this to your catalinaHome/webapps folder – John Snow Apr 11 '13 at 12:07