aspose file tools *
The moose likes IDEs, Version Control and other tools and the fly likes Where to put the servlet.jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Where to put the servlet.jar" Watch "Where to put the servlet.jar" New topic
Author

Where to put the servlet.jar

Bob Robertson
Greenhorn

Joined: May 16, 2004
Posts: 17
Hello,

I am curious to know about how to manage my local development of a webapp and the Tomcat server I'm deploying to.

I'm using Netbeans 4.1 where I include the servlet api so those classes are available to me in my project. However, I don't think I should have to include it in my app's lib directory seeing as how Tomcat will already be running that for me. Do I just need to make sure that my ant deploy task omits that jar from the build or do I need to have the api in both the Tomcat lib and the webapp's lib?

Thanks in advance!

br
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Moving to the IDE's forum where the Netbeans guru's hang out.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61794
    
  67

You should most definitely not make a copy of the jar file in your web app's folder. Leave it in the Tomcat common lib and only there.

You do not want to get into a situation where the container is picking up an obsolote jar file that was copied about.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bob Robertson
Greenhorn

Joined: May 16, 2004
Posts: 17
Well, not that this is really an IDE question, but whatever... probably more an ANT topic, but definitiely servlets... when I'm in the project whether working in notepad or whatever, I need to tell ANT what to do. It needs to know what libraries to use when compiling. However, my local enviornrment maybe windows with a local version of Tomcat, but I'm deploying to a Linux box where I have no visibility outside of dropping in the war file to a folder. I could just set the classpath to the local tomcat instance's servlet.jar but that doesn't seem right. Plus, how will that affect my deployment? Do I need to configure some env variable to abstract this?

I need my project to compile so I can build the WAR, but I don't want to include a servlet.jar in my lib folder of my webapp. How do I organize my project make sure I avoid conflicts? And will Tomcat by default override whatever servlet.jar I've specified with its own?

Thanks!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61794
    
  67

Originally posted by Bob Robertson:
I need my project to compile so I can build the WAR, but I don't want to include a servlet.jar in my lib folder of my webapp


Correct. If you are building on a different system than Tomcat is installed upon, you'll need a local copy of the APIs to build against. Make sure that the file is in the classpath of the compile, but not somewhere where it will become part of the generated war file.

If the compile occurs on the same system, just add Tomcat's copy of the API to your compilation classpath.

Originally posted by Bob Robertson:
And will Tomcat by default override whatever servlet.jar I've specified with its own?


Tomcat will have a copy of the API on its own classpath -- you don't need to worry about it.
[ December 29, 2005: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where to put the servlet.jar