Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 8th, 2007, 4:44 AM   #1
lucifer
Programmer
 
lucifer's Avatar
 
Join Date: Oct 2005
Posts: 84
Rep Power: 4 lucifer is on a distinguished road
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)
plz help
__________________
"You're good... but me, I'm magic"
lucifer is offline   Reply With Quote
Old Jun 8th, 2007, 5:37 AM   #2
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
The errors explain themselves.
simple.java:4: class Simple is public, should be declared in a file named Simple.java
...your class 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
javax.servlet doesn't exist. Note that it is part of the enterprise edition (J2EE), rather than the standard edition. You need to have the right distribution installed in order to use these features.

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
Dameon is offline   Reply With Quote
Old Jun 8th, 2007, 6:51 AM   #3
lucifer
Programmer
 
lucifer's Avatar
 
Join Date: Oct 2005
Posts: 84
Rep Power: 4 lucifer is on a distinguished road
Quote:
Originally Posted by Dameon View Post
The errors explain themselves.
simple.java:4: class Simple is public, should be declared in a file named Simple.java
...your class 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
javax.servlet doesn't exist. Note that it is part of the enterprise edition (J2EE), rather than the standard edition. You need to have the right distribution installed in order to use these features.

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
first error i have corrected and i have java enterprise edition installed but still these errors come
__________________
"You're good... but me, I'm magic"
lucifer is offline   Reply With Quote
Old Jun 8th, 2007, 9:40 AM   #4
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 3 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
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!
ReggaetonKing is offline   Reply With Quote
Old Jun 9th, 2007, 10:13 AM   #5
msi_333
Newbie
 
msi_333's Avatar
 
Join Date: May 2007
Location: Egypt
Posts: 19
Rep Power: 0 msi_333 is on a distinguished road
Send a message via Yahoo to msi_333
Lightbulb Why don't you

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/
msi_333 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:20 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC