Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Unresolved import javax.servlet under Netbeans 4.0

Reply
Thread Tools

Unresolved import javax.servlet under Netbeans 4.0

 
 
Andrew Mayo
Guest
Posts: n/a
 
      01-31-2005
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?.
 
Reply With Quote
 
 
 
 
Ryan Stewart
Guest
Posts: n/a
 
      01-31-2005
"Andrew Mayo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Eclipse vs. Netbeans. Netbeans is winning me over almost at first glance. Thomas G. Marshall Java 2 10-16-2006 02:54 AM
Netbeans 5.5 & JWSDP 2 with .xml.bind import problems Andy Java 1 04-05-2006 10:11 AM
Import netbeans project into JBuilder 2005 Foundation al schmid Java 0 04-16-2005 09:38 AM
[NETBEANS] [EVALUATION] - E12 - The NetBeans Open Source Lie Ilias Lazaridis Java 0 12-12-2004 02:41 PM
Building a GUI using NetBeans platform (not Netbeans IDE !) Pimousse Java 2 04-21-2004 07:22 AM



Advertisments