You don't need IDE to compile servlets. IDE are used to write servlets/JSPs/HTML/regular java classes in a very convenient way. Compile the servlet the way you compile regular java classes using javac command.
Well , the major diff between using an IDE and compiling the java resources from say command prompt is setting the classpath entries.
When you use some IDE(e.g Eclipse), the IDE takes care of the classpath and environment entries. Like the JDK path etc is taken care when u install the IDE and specify the JDK path for the first time.
But for external dependent jar files , we need to add them in the build classpath entries in the IDE.
e.g When you are writing a servlet using an IDE, for compiling your servlet class , you need to put your servlet.jar file in your Add external libraries (dependencies )tab.
Wheread when you try to compile your java resource from command line ,here your servket class , you need to set the complete servlet.jar path in your environment entries (as classpath)and compile your servlet class like any other java resouce.