Unresolved import javax.servlet under Netbeans 4.0

Discussion in 'Java' started by Andrew Mayo, Jan 31, 2005.

  1. Andrew Mayo

    Andrew Mayo Guest

    Running tomcat 5.0.28, netbeans 4.0, J2SE 1.4.2_06, Windows XP SP1

    Create hello world servlet, with usual imports i.e

    import javax.servlet.*;
    import javax.servlet.http.*;


    On clean rebuild of project, Netbeans cannot resolve these imports;
    however, have tried the following

    (a) Ensuring classpath points to Tomcat servlet jar i.e in my case

    C:\tomcat\jakarta-tomcat-5.0.28\common\lib\servlet-api.jar

    which jar tvf confirms contains the expected javax class hierarchy


    (b) From command line, javac successfully compiles servlet class code,
    indicating classpath is correct and that code is correct
    syntactically.

    (c) Attempted to add reference to servlet jar using tools/library
    manager in Netbeans - (unimpressed, btw, with the UI which clips off
    vital command buttons at 800 X 600 resolution!). Did this by creating
    new library, called TomcatServlets, added path to filename as above by
    browsing, so that display now reads:-

    jar:file:/C:/tomcat/jakarta-tomcat-5.0.28/common/lib/servlet-api.jar!/

    Didn't work, so tried pointing this library ref at the internal tomcat
    servlet-api.jar file in

    C:\Program Files\netbeans-4.0\nb4.0\jakarta-tomcat-5.0.28\common\lib

    But this didn't work either.

    Therefore, despite all attempts, doing clean rebuild on project in
    Netbeans cannot locate the servlet classes. But javac works from the
    command line!

    wtf am I doing wrong?.
    Andrew Mayo, Jan 31, 2005
    #1
    1. Advertising

  2. Andrew Mayo

    Ryan Stewart Guest

    "Andrew Mayo" <> wrote in message
    news:...
    > Running tomcat 5.0.28, netbeans 4.0, J2SE 1.4.2_06, Windows XP SP1
    >
    > Create hello world servlet, with usual imports i.e
    >
    > import javax.servlet.*;
    > import javax.servlet.http.*;
    >
    >
    > On clean rebuild of project, Netbeans cannot resolve these imports;
    > however, have tried the following
    >
    > (a) Ensuring classpath points to Tomcat servlet jar

    [...]
    I doubt that NetBeans 4 uses the system classpath, so this won't help.

    [...]
    > (c) Attempted to add reference to servlet jar using tools/library
    > manager in Netbeans - (unimpressed, btw, with the UI which clips off
    > vital command buttons at 800 X 600 resolution!). Did this by creating
    > new library, called TomcatServlets, added path to filename as above by
    > browsing, so that display now reads:-
    >
    > jar:file:/C:/tomcat/jakarta-tomcat-5.0.28/common/lib/servlet-api.jar!/
    >

    Did you add the library to your project or just create the library? See Project
    properties -> Build -> Compiling sources
    Ryan Stewart, Jan 31, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. chamikara
    Replies:
    1
    Views:
    49,832
  2. HARI OM
    Replies:
    0
    Views:
    9,349
    HARI OM
    May 4, 2005
  3. Andrew Thompson

    javax.servlet and javax.servlet.http

    Andrew Thompson, Apr 24, 2007, in forum: Java
    Replies:
    1
    Views:
    635
    newbie_at_tomcat
    Apr 25, 2007
  4. Lew
    Replies:
    1
    Views:
    603
    newbie_at_tomcat
    Apr 25, 2007
  5. jojo.hikaru
    Replies:
    0
    Views:
    1,762
    jojo.hikaru
    Jun 25, 2009
Loading...

Share This Page