Hello Every Body: Tomcat is running. I can execute tomcat servlet examples. They work fine. But I can not compile my simple servlet as below. import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloServlet extends HTTPServlet { public void doGet(HTTPServletRequest req, HTTPServletResponse res) throws HTTPServtException, IOException { PrintWriter out = res.getWriter(); out.println("Hello"); } } I had following errors. HelloServlet.java:2 package javax.servlet does not exit HelloServlet.java:2 package javax.servlet.hhtp does not exit I have set class path C:\tomcat\lib\servlet.jar. Set TOMCAT_HOME = tomcat. SET JAVA_HOME=jdk1.3. Even I copied servlet.jar file from tomcat/lib folder to tomcat\webapps\example folder. This is the place I am compiling my servlet. It did not help. Please help me what is the problem? Thanks. BK
Include on the command line the classpath variable.
It looks something like this: javac -classpath d:\jars\servlet.jar;d:\jars\j2ee.jar MyClass.java
you'd of course, replace the path with the path to wherever you have servlet.jar
Dharmesh Chheda
Ranch Hand
Joined: May 08, 2001
Posts: 204
posted
0
Hey Bal you have not mentioned the specific error you getting but still when i say your code i noticed that you have written public void doGet(HTTPServletRequest req, HTTPServletResponse res)throws HTTPServtException, IOException which infact should be public void doGet(HttpServletRequest req,HttpServletResponse res) throws HttpServtException, IOException the HTTP should be Http replace it and check it out
------------------ IBM Certified WebSphere Application Server V3.5 Specialist
regards,<br />Dharmesh Chheda
Bal Sharma
Ranch Hand
Joined: Sep 19, 2001
Posts: 273
posted
0
Hello Dharmesh: THANKS THOUGH FOR YOUR RESPONSE. IT IS NOT WORKING. I FIXED AS YOU INDICATED. IF THAT WAS A PROBLEM I SHOULD HAVE GOT CLASS NOT FOUND EXCEPTION ERROR. I AM GETTING FOLLOWING ERROR. I AM TRYING THIS SINCE LAST MONDAY. HelloServlet.java:2: package javax.servlet does not esit import javax.servlet.*; HelloServlet.java:3: package javax.servlet.hhtp does not esit import javax.servlet.http.*; HelloServlet.java:5: cannot resolve symbol symbol : class HTTPServlet locatio: class HelloServlet public class HelloServlet extends HTTPServket HelloServlet.java:7: cannot resolve symbol symbol : class HTTPServletRequest locatio: class HelloServlet public void doGet(HTTPServletRequest req, HTTPServletResponse res) FUNNY THING IS TOMCAT IS RUNNING. TOMCAT EXAMPLES ARE WORKING FINE. IF I AM NOT MISTAKEN, ONCE I USE TOMCAT FOR SERVLET "package javax.servlet and package javax.servlet.hTtp" SHOULD BE INCLUDED "C:\tomcat\lib\servlet.jar" files RIGHT! WHY IT IS NOT RECOGNIZING. IF ANYONE HAVE BEEN BEEN BEFORE IN THIS PROBLEM PLEASE LET ME KNOW HOW TO FIX IT. THANKS GUYS. BK
Originally posted by Dharmesh Chheda: Hey Bal you have not mentioned the specific error you getting but still when i say your code i noticed that you have written public void doGet(HTTPServletRequest req, HTTPServletResponse res)throws HTTPServtException, IOException which infact should be public void doGet(HttpServletRequest req,HttpServletResponse res) throws HttpServtException, IOException the HTTP should be Http replace it and check it out
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.