Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with compiling servlets

 
Ravi Kotha
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

i have write a servlet...but iam unable to compile the servlet. While compilation its showing errors like "package java.servlet.http.*" does not exist. I have installed sun application server. I have set the CLASSPATH as

"C:\Sun\AppServer\jdk\lib\dt.jar;C:\Sun\AppServer\jdk\lib\tools.jar;.;"

Whats wrong with me?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add the JAR file containing the servlet api.
Search for a file called something like servlet-api.jar.

By the way, you were not preparing for SCJP ? (no servlet)
[ March 02, 2006: Message edited by: Satou kurinosuke ]
 
Ravi Kotha
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello frnd,

Thanks for your response, yes iam preparing for SCJP. also for j2ee.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you should concentrate on SCJP first, and leave servlets for later
Anyway, good luck.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Tomcat web server instead of sun application server.
 
Ravi Kotha
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,

I have searched for the file servlet-api.jar.. I found this file in my Netbean IDE. The path for this file is

"C:\Program Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9\common\lib"

shall i set the CLASSPATH to this directory?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set
"C:\Program Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9\common\lib\servlet-api.jar"
to your path.
 
chengchuan lu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not java.servlet.http.*;
correct is javax.servlet.http.*;
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic