FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Noob Java Error





umeshtangnu
Hi i m learning java n
i have written the following program but it does not compile



Code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Simple implements Filter
{
    public void doFilter(ServletRequest request, ServletResponse response,    FilterChain chain)
    throws IOException, ServletException
  {
 
  }

  public void destroy()
  {
   
  }

  public void init(FilterConfig filterConfig)
  {
   
  }

}



when i comepile i get following errors


Code:

simple.java:4: class Simple is public, should be declared in a file named Simple.java
public class Simple implements Filter
       ^
simple.java:2: package javax.servlet does not exist
import javax.servlet.*;
^
simple.java:3: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
simple.java:4: cannot find symbol
symbol: class Filter
public class Simple implements Filter
                               ^
simple.java:6: cannot find symbol
symbol  : class ServletRequest
location: class Simple
    public void doFilter(ServletRequest request, ServletResponse response,
                         ^
simple.java:6: cannot find symbol
symbol  : class ServletResponse
location: class Simple
    public void doFilter(ServletRequest request, ServletResponse response,
                                                 ^
simple.java:7: cannot find symbol
symbol  : class FilterChain
location: class Simple
    FilterChain chain)
    ^
simple.java:8: cannot find symbol
symbol  : class ServletException
location: class Simple
    throws IOException, ServletException
                        ^
simple.java:18: cannot find symbol
symbol  : class FilterConfig
location: class Simple
  public void init(FilterConfig filterConfig)
Stubru Freak
Two errors:
1. The file should be called Simple.java
2. javax.servlet is not found, make sure you have something installed that provides those files.
varun_dodla
Quote:

2. javax.servlet is not found, make sure you have something installed that provides those files.


You can download the sevlet api from this page :
http://java.sun.com/products/servlet/archive.html#ServletApi2.1.1

Place the downloaded Jar(s) in your classpath. The program should compile without any errors.

Hope this helps.
Related topics
mysql java connector classpath error
Java applet error.
Java script error
Java project coupling problems
phpBB2 Plus 1.52 error [SOLVED]
Some times, the error is so hard to find and so funny
Java Problem
Make a post with JAVA client
All Java-Based Apps Are Unstable
problem with java script file
N00b Java Question
Problem with javax.sound.midi (Java)
[Java] Wanna help me figure out this error?
Problems with Java?
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.