• 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

Can not compile, please help me

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
When I am trying to compile my code, following compile time error comes. I had set the classpath too.
Please help me.
***************************************************************************
D:\Servlet\Servlet1>set classpath=D:\Tomcat*\common\lib\servlet-api.jar

D:\Servlet\Servlet1>javac -d ./WEB-INF/classes LoginForm.java
LoginForm.java:1: package javax.servlet does not exist
import javax.servlet.*;
^
LoginForm.java:2: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
LoginForm.java:7: cannot find symbol
symbol: class HttpServlet
public class LoginForm extends HttpServlet{
^
LoginForm.java:8: cannot find symbol
symbol : class HttpServletRequset
location: class LoginForm
public void service(HttpServletRequset req, HttpServletResponse res)
^
LoginForm.java:8: cannot find symbol
symbol : class HttpServletResponse
location: class LoginForm
public void service(HttpServletRequset req, HttpServletResponse res)
^
LoginForm.java:9: cannot find symbol
symbol : class ServletException
location: class LoginForm
throws ServletException, IOException{
^
6 errors
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sandeep Mukherji:
... I had set the classpath too.



It looks like it's not set correctly.
See:
http://faq.javaranch.com/java/CompilingServlets
 
Sandeep Mukherji
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

Thanks for the link. It's really very informative. But, please tell me which jar file(s) or class(es) is to be set in order to use the packages javax.servlet.* and javax.servlet.http.*
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The jar file is servlet-api.jar.

If you're using Tomcat 6.0 or higher it can be found in:
tomcat/lib

For 5x versions, it's in:
tomcat/common/lib
 
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic