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