Unresolved import javax.servlet under Netbeans 4.0

A

Andrew Mayo

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?.
 
R

Ryan Stewart

Andrew Mayo said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top