![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 84
Rep Power: 4
![]() |
Noob Java Error
Hi i m learning java n
i have written the following program but it does not compile 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 come i get following errors
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)
__________________
"You're good... but me, I'm magic" |
|
|
|
|
|
#2 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
The errors explain themselves.
simple.java:4: class Simple is public, should be declared in a file named Simple.java Public classes in Java need to be in a file by the same name. simple.java:2: package javax.servlet does not exist The "cannot find symbol" errors are a simple consequence of the imaginary javax.servlet package. When that problem is corrected, the compiler will know where to find them
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#3 | |
|
Programmer
Join Date: Oct 2005
Posts: 84
Rep Power: 4
![]() |
Quote:
__________________
"You're good... but me, I'm magic" |
|
|
|
|
|
|
#4 |
|
Sexy Programmer
|
If you are using windows, did you set Java EE's bin directory in your CLASSPATH?
__________________
I would love to change the world, but they won't give me the source code! |
|
|
|
|
|
#5 |
|
Newbie
|
Why don't you use NetBeans IDE and make the life easier to you .It is already contain J2ee and Tomcat built in and when you run your program it open the browser for you .what you will do is write the code and press the button to run
Download it from here , http://www.netbeans.org/ |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming with Java: Tutorial | ReggaetonKing | Java | 7 | May 20th, 2008 10:58 AM |
| Header file internal errors | kruptof | Coder's Corner Lounge | 2 | Jan 14th, 2007 1:12 PM |
| C# corruption!!! | Kilo | C++ | 32 | May 21st, 2006 8:44 PM |
| Masm | rsnd | Assembly | 4 | May 20th, 2006 9:05 PM |
| libraries | matko | C | 1 | Jan 22nd, 2006 2:12 PM |