Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to compile java file in Tomcat ?

TatonSep 7 2006 — edited Sep 7 2006
Hi all,
I have a java file named Ch1Servlet.java under project1/src directory
there is classes directory project1/classes and web.xml under src directory
project1/src directory.
Now to compile i have to give %javac -classpath /your path/tomcat/common/lib/servlet-api.jar -d classes src/Ch1Servlet.java
What is this your path ? Tomcat 5.0 is installed in C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib with servlet-api.jar
Please help me out.
Best Regards
Taton
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Ch1Servlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
PrintWriter out = response.getWriter();
java.util.Date today = new java.util.Date();
out.println("<html>"+"<body>"+"<h1 align = center>HF\'s Chapter 1 Servlet</h1>"+"<br>"+today+"</body>"+"</html>");
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2006
Added on Sep 7 2006
6 comments
804 views