Hi, I recently downloaded Acme API and I was wondering where I should place it so the servlets can use it. Thanks!
posted 15 years ago
Where you place third-party APIs depends both on how available you want to make them to other software, how they are packaged, and which servlet container you are using. If your extra classes are in one or more jar files, and you wish to make them available to all your Java programs, just put the jar file(s) in the jre/lib/ext directory of your Java SDK. If you have jar files and you want to make them available to all your servlets you may have a directory scanned by the servlet container Resin looks in resin/lib, for example. If you only want to make the jar files visible to a single web-app or even just a single servlet, you will need to add a <classpath> tag to your server configuration file or to the web.xml file for your web app. If you just have a directory structure full of class files, you can either jar them up and use the methods above, or add their location to either your system classpath, or add their root directory in a <classpath> tag as above.