Is "javax.servlet" included in Eclipse SDK

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Feb 2008
Posts: 88
Reputation: knight fyre is an unknown quantity at this point 
Solved Threads: 1
knight fyre's Avatar
knight fyre knight fyre is offline Offline
Junior Poster in Training

Is "javax.servlet" included in Eclipse SDK

 
0
  #1
Jun 29th, 2008
I'm trying to learn Java Servlets on my own but I'm having some very basic problems.

The code
  1. "import javax.servlet.ServletException;"
produces a compiler error, "the import javax.servlet cannot be resolved".

I'm using version 3.2.2. Why am I having this problem?
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: Is "javax.servlet" included in Eclipse SDK

 
0
  #2
Jun 29th, 2008
Nope by default the Java Plugin for Eclipse only includes Core Java, Servlets are not a part of that.
A short cut to resolve that error would be, in case you have tomcat / some other java enabled server installed, just check in their "lib" folder if you find any jar called "servlet.jar" or "j2ee.jar" or something similar in name and add it to your project's build path in Eclipse, this should solve the compile error.

However you will not be able to test your servlets directly via Eclipse in this case
Last edited by stephen84s; Jun 29th, 2008 at 6:45 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 88
Reputation: knight fyre is an unknown quantity at this point 
Solved Threads: 1
knight fyre's Avatar
knight fyre knight fyre is offline Offline
Junior Poster in Training

Re: Is "javax.servlet" included in Eclipse SDK

 
0
  #3
Jun 30th, 2008
I'm using Tomcat 5.0.

There are multiple lib folders and none of the jar files match exactly. Which folder should I look into? Even if I choose the right folder how exactly should I add it the built path? I attached the search result of "lib".

What is the other method of installing the servlet package?
Attached Thumbnails
searcheresults.JPG  
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: Is "javax.servlet" included in Eclipse SDK

 
0
  #4
Jun 30th, 2008
if you are using the latest version of tomcat 6.0+ there is a "lib" folder in the ROOT directory of tomcat, you should find the servlet.jar file there.
In tomcat 5.0 I assume it should be in $CATALINA_HOME/share/lib The second way is to install the J2EE Standard Tools plugin for eclipse.
Last edited by stephen84s; Jun 30th, 2008 at 3:11 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 88
Reputation: knight fyre is an unknown quantity at this point 
Solved Threads: 1
knight fyre's Avatar
knight fyre knight fyre is offline Offline
Junior Poster in Training

Re: Is "javax.servlet" included in Eclipse SDK

 
0
  #5
Jun 30th, 2008
I found the jar file with the packages. Problem solved.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC