Yes, your source file can be anywhere (including nowhere).
Tomcat doesn't do anything with your
Java source files.
You need to create a folder for your application under tomcat/webapps.
You can name it anything you like (say 'myApp' for this discussion).
Inside that folder, you need another one named WEB-INF (case sensitive).
Inside WEB-INF, you need to create a folder named 'classes'.
The classes directory is where your package directory structure goes.
You class files go in the proper package folders.
Example:
A real quick way to get a sample, 'Hello, World' application with a proper directory structure and deployment descriptor up and running is to download our SimpleServlet.war example to your webapps directory. Tomcat will unpack this war file and deploy the application for you.
You can find this example in our
CodeBarn See:
http://faq.javaranch.com/java/CodeBarnSimpleServlet [ March 29, 2008: Message edited by: Ben Souther ]