• Post Reply Bookmark Topic Watch Topic
  • New Topic

compiling servlets

 
Delano Pagee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've download J2SE 6u 1 to compile servlets using Eclipse 3.3, import javax.servlet.*; error... can not be resolved... Can someone help with which java compiler to using for compiling servlets & JSP

Thanks!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your compiler is fine. What you need is a library called servlet-api.jar. If you have installed Tomcat, it's in the common/lib directory. Go to the settings of your Eclipse project, and set this library in the Java build path.
 
Delano Pagee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Done... but nothing happened... I checked the java build path for the project after adding the api-servlet jar... source attachment NONE... I think it the complete javax.servlet classes are missing from the JDK 6 u1... I checked the source code for JDK 6 u1 and their not there either... what do ya think?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Delano Pagee:
Done... but nothing happened... I checked the java build path for the project after adding the api-servlet jar... source attachment NONE... I think it the complete javax.servlet classes are missing from the JDK 6 u1... I checked the source code for JDK 6 u1 and their not there either... what do ya think?


That's right. They are not part of the JDK. They are part of the Java Enterprise Edition (JEE). As Satou pointed out, the easiest thing to do is grab the servlet-api.jar and place it in your classpath. In Eclipse, it's as Satou said.

What do you mean by "but nothing happened" and "...NONE..."?
 
Bert Bates
author
Sheriff
Posts: 8919
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With all due respect, I'm gonna slide this over to the servlets forum.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This gets asked a lot here so we have a FAQ entry on compiling servlets.
http://faq.javaranch.com/view?CompilingServlets

If you're unfamiliar with setting your classpath, let me know and I'll move this thread to our Java In General (Beginner) forum where javac and classpath issues are best discussed.

If you're having trouble getting a particular IDE to pickup servlet-api.jar, then also let me know. We have a forum for IDEs where configuration issues are covered.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!