views:

247

answers:

3

Hi,

Lately I have been trying my hands on Eclipse IDE for java development. I am mostly a novice to java programming. I am trying a servlet project, using Tomcat5.5 as container. I am getting issues when I give import javax.servlet.* statement in my class files, as Eclipse complains that it cannot find that particular package. I am working in windows environment, and have already included following on my classpath:

.;C:\Program Files\Java\jre1.6.0_07\lib\ext\QTJava.zip;C:\Program Files\Java\jdk1.6.0_13\bin;C:\Program Files\Apache Software Foundation\Tomcat\common\lib\servlet-api.jar;C:\Program Files\Apache Software Foundation\Tomcat\common\lib\jsp-api.jar;C:\Program Files\Apache Software Foundation\Tomcat\common\lib

Any ideas, as what might be going wrong?

Thanks in advance!

A: 

There's a similar question here: how do you make eclipse recognize jee jar files so servlets can compile

Bedwyr Humphreys
Thanks...for pointing me to right thread! :-)
Ankush
A: 

Add a lib folder to the project and put in required jars. Then right-click on each jar and add to build-path.

Ankush
+1  A: 

One last thing: that CLASSPATH value you posted looks suspiciously like a Windows system environment variable value. You need to know that every IDE and Java EE app server out there, including Eclipse and Tomcat, completely ignores CLASSPATH environment values. It's best to know how to set CLASSPATH appropriately for your situation. I don't have a CLASSPATH environment setting on any machine that I work on.

duffymo
Thanks for your input on this...yes, it actually is environment variable value. Pardon me for my lack of knowledge on this issue,...but just so that I correctly comprehend what you are saying: is that the value we set in classpath env. variable does not get used by any IDEs or j2ee servers, so we separately need to modify CLASSPATHS for each project??...
Ankush
Of course, because every project is different. Each IDE has their own was of setting CLASSPATH. Java EE app servers have conventions that you're expected to follow. It's not nearly as big a problem as you're making it out to be.
duffymo