• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compile error

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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();
/* some code */
}
}
*******************************
Error
1.package javax.servlet does not exist
import javax.servlet.*;
^
2.package javax.servlet.http does not exist
import javax.servlet.http.*;
^
3.cannot find symbol for class HttpServlet,class HttpServletRequest & class HttpServletResponse.

Please note that i have installed jdk 1.6,jre 1.6 & apache tomcat 6.0.Classpath is also set properly.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vivek Gajabe:
Classpath is also set properly.



Incorrect. Your classpath should include the servlet-api.jar that comes with Apache Tomcat. It doesn't, which is why you get these errors.
 
Vivek Gajabe
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot!!!
It's working. I have not included the jar file name in classpath, thats why it showed me an error.
Thanks!!!
 
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic