Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » eclipse can't find javax.servlet
eclipse can't find javax.servlet [message #216574] Wed, 02 July 2008 01:32 Go to next message
Eclipse UserFriend
Originally posted by: cuco2772.gmail.com

I just downloaded ganymede, I'm trying to do a simple tutorial, but am
getting this error. I have my Window->Peferences->Installed JREs set to
/usr/lib/jdk/jre. Here's my /etc/eclipse/java_home:

/usr/lib/jvm/java-6-sun
/usr/lib/jvm/java-6-sun-1.6.0.00
/usr/lib/jdk
/usr/lib/jvm/java-1.5.0-sun
/usr/lib/jvm/java-gcj
/usr/lib/kaffe/pthreads
/usr/lib/j2se/1.5
/usr/lib/j2se/1.4
/usr/lib/j2sdk1.5-ibm
/usr/lib/j2sdk1.4-ibm
/usr/lib/j2sdk1.6-sun
/usr/lib/j2sdk1.5-sun
/usr/lib/j2sdk1.4-sun

Shouldn't it find these classes in the /usr/lib/jdk directory ?
Re: eclipse can't find javax.servlet [message #216582 is a reply to message #216574] Wed, 02 July 2008 03:19 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

Adam Posner wrote:
> I just downloaded ganymede, I'm trying to do a simple tutorial, but am
> getting this error. I have my Window->Peferences->Installed JREs set to
> /usr/lib/jdk/jre. Here's my /etc/eclipse/java_home:
>
> /usr/lib/jvm/java-6-sun
> /usr/lib/jvm/java-6-sun-1.6.0.00
> /usr/lib/jdk
> /usr/lib/jvm/java-1.5.0-sun
> /usr/lib/jvm/java-gcj
> /usr/lib/kaffe/pthreads
> /usr/lib/j2se/1.5
> /usr/lib/j2se/1.4
> /usr/lib/j2sdk1.5-ibm
> /usr/lib/j2sdk1.4-ibm
> /usr/lib/j2sdk1.6-sun
> /usr/lib/j2sdk1.5-sun
> /usr/lib/j2sdk1.4-sun
>
> Shouldn't it find these classes in the /usr/lib/jdk directory ?
>

Adam,

I'm still a neophyte and I'm not certain formally about any of this, but
in my installations (I have several), javax.servlet* are found in my
Eclipse plugins directory. I am avoiding upgrading to Ganymede for now,
so maybe this stuff goes elsewhere? Anyway, here's where mine are on
Windows and, a quick look tells me that on SuSE Linux I find them there too:



C:\tutorial>dir /s javax.*
Volume in drive C has no label.
Volume Serial Number is B0CE-6693

Directory of C:\tutorial\eclipse\plugins

02/28/2008 03:01 AM 62,681 javax.servlet.jsp_2.0.0.v200706191603.jar

02/28/2008 03:01 AM 107,606 javax.servlet_2.4.0.v200706111738.jar
02/28/2008 03:01 AM 116,414 javax.wsdl15_1.5.1.v200705290614.jar
02/28/2008 03:01 AM 116,357 javax.wsdl_1.4.0.v200706111329.jar
03/08/2008 02:35 PM <DIR> javax.xml.rpc_1.1.0.v200706111329
03/08/2008 02:35 PM <DIR> javax.xml.soap_1.2.0.v200706111329
4 File(s) 403,058 bytes

Directory of C:\tutorial\jakarta-taglibs-standard-1.1.2\javadoc

04/19/2008 02:58 PM <DIR> javax
0 File(s) 0 bytes

Total Files Listed:
4 File(s) 403,058 bytes
3 Dir(s) 91,026,206,720 bytes free
Re: eclipse can't find javax.servlet [message #216613 is a reply to message #216574] Wed, 02 July 2008 12:42 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Adam Posner wrote:
> I just downloaded ganymede, I'm trying to do a simple tutorial, but am
> getting this error. I have my Window->Peferences->Installed JREs set to
> /usr/lib/jdk/jre. Here's my /etc/eclipse/java_home:
>
> /usr/lib/jvm/java-6-sun
> /usr/lib/jvm/java-6-sun-1.6.0.00
> /usr/lib/jdk
> /usr/lib/jvm/java-1.5.0-sun
> /usr/lib/jvm/java-gcj
> /usr/lib/kaffe/pthreads
> /usr/lib/j2se/1.5
> /usr/lib/j2se/1.4
> /usr/lib/j2sdk1.5-ibm
> /usr/lib/j2sdk1.4-ibm
> /usr/lib/j2sdk1.6-sun
> /usr/lib/j2sdk1.5-sun
> /usr/lib/j2sdk1.4-sun
>
> Shouldn't it find these classes in the /usr/lib/jdk directory ?
>

javax.servlet is part of Java EE, so won't be part of Java SE, i.e.
won't be part of your JRE or JDK. Java EE classes like this are
supplied by the Java EE application server or servlet container (such as
Tomcat). Thus, they will come from the Server Runtime Environment
(a.k.a. Target Runtime) specified by Window -> Preferences -> Server ->
Runtime Environments. One of the runtimes defined there would be
associated with your WTP based project to provide the javax.servlet classes.

Cheers,
Larry
Re: eclipse can't find javax.servlet [message #216657 is a reply to message #216613] Wed, 02 July 2008 20:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cuco2772.gmail.com

I now have Windofkeltia's tutorial working on Ganymede with
apache-tomcat-6.0.16, the version I have in
my /home/cuco directory. Russ, I think you should update your tutorial to
say that you need to associate your project with a server runtime in the
beginning
when you're first setting or your project in eclipse. That screenshot
doesn't have any selected, that seemed to be what was causing the problem
with finding javax.servlet.


Larry, your quote below brings me to one point I've been a bit confused
about for awhile:

javax.servlet is part of Java EE, so won't be part of Java SE, i.e. won't
be part of your JRE or JDK. Java EE classes like this are supplied by the
Java EE application server or servlet container (such as Tomcat). Thus,
they will come from the Server Runtime Environment (a.k.a. Target Runtime)
specified by Window -> Preferences -> Server -> Runtime Environments. One
of the runtimes defined there would be associated with your WTP based
project to provide the javax.servlet classes.

My apache-tomcat-6.0.16/lib has a servlet-api.jar, which I assume is what
you're referring to.
But I downloaded from Sun what they call the 'Java EE 5 SDK with JDK 6u6'.
I thought that had all the javax.servlet definitions in it.
But if I say 'locate javax.servlet' at a terminal prompt, all I get is
this:

/home/cuco/eclipse/plugins/javax.servlet_2.4.0.v200806031604 .jar
/home/cuco/eclipse/plugins/javax.servlet.jsp_2.0.0.v20080603 1607.jar

which is kind of surprising. But if I say 'locate servlet-api', the only
things that come up are in tomcat installations. I guess this makes sense
since
tomcat is a servlet container and you can't launch any servlets without an
application sever.
I guess I was under the impression that all that stuff would also
be in the EE 5 SDK too. The mistaken assumptions of a noob!
Thanks for your help.
Re: eclipse can't find javax.servlet [message #216729 is a reply to message #216657] Thu, 03 July 2008 12:00 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Adam Posner wrote:
> I now have Windofkeltia's tutorial working on Ganymede with
> apache-tomcat-6.0.16, the version I have in
> my /home/cuco directory. Russ, I think you should update your tutorial
> to say that you need to associate your project with a server runtime in
> the beginning
> when you're first setting or your project in eclipse. That screenshot
> doesn't have any selected, that seemed to be what was causing the problem
> with finding javax.servlet.
>
>
> Larry, your quote below brings me to one point I've been a bit confused
> about for awhile:
>
> javax.servlet is part of Java EE, so won't be part of Java SE, i.e.
> won't be part of your JRE or JDK. Java EE classes like this are
> supplied by the Java EE application server or servlet container (such as
> Tomcat). Thus, they will come from the Server Runtime Environment
> (a.k.a. Target Runtime) specified by Window -> Preferences -> Server ->
> Runtime Environments. One of the runtimes defined there would be
> associated with your WTP based project to provide the javax.servlet
> classes.
>
> My apache-tomcat-6.0.16/lib has a servlet-api.jar, which I assume is
> what you're referring to.
> But I downloaded from Sun what they call the 'Java EE 5 SDK with JDK 6u6'.
> I thought that had all the javax.servlet definitions in it.

I haven't used the Java EE downloads from Sun in quite a while, but if I
recall correctly, the Java EE classes tended to come in one *big* jar
containing "everything", "j2ee.jar" perhaps. It leads to lots of
"interesting" problems when someone uses the "Why not, what could go
wrong?" approach to webapp building and mistakenly tosses that monster
jar into their "WEB-INF/lib"!

> But if I say 'locate javax.servlet' at a terminal prompt, all I get is
> this:
>
> /home/cuco/eclipse/plugins/javax.servlet_2.4.0.v200806031604 .jar
> /home/cuco/eclipse/plugins/javax.servlet.jsp_2.0.0.v20080603 1607.jar
>
> which is kind of surprising. But if I say 'locate servlet-api', the only
> things that come up are in tomcat installations. I guess this makes
> sense since
> tomcat is a servlet container and you can't launch any servlets without
> an application sever.
> I guess I was under the impression that all that stuff would also
> be in the EE 5 SDK too. The mistaken assumptions of a noob!
> Thanks for your help.
>

The plug-ins you cite above are primarily for internal use by Eclipse at
runtime. If you were building a new plug-in that needed javax.servlet
classes, you would likely make your plug-in depend on them, like other
plug-ins have done.

One of the internal uses is for the servlet container which the help
system uses. This server used to be a version of Tomcat, which is why
you would also see a ".../eclipse/plugins/org.eclipse.tomcat_4.1.???"
folder in Eclipse 3.2.x and earlier. This folder is still there in
Eclipse 3.3, but the help server was replaced by Jetty.

In WTP 2.0.x and later, the J2EE Preview server runtime (under the Basic
category) creates a runtime from this internal version of Jetty. In
doing so, it will in fact use the jars you cite above as part of the
server runtime. But for other server runtimes, those classes must come
from jars supplied by the server installation.

Cheers,
Larry
Re: eclipse can't find javax.servlet [message #217262 is a reply to message #216574] Wed, 09 July 2008 20:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bill.davidson.gmail.com

Adam Posner wrote:
> I just downloaded ganymede, I'm trying to do a simple tutorial, but am
> getting this error. I have my Window->Peferences->Installed JREs set to
> /usr/lib/jdk/jre. Here's my /etc/eclipse/java_home:
>
> Shouldn't it find these classes in the /usr/lib/jdk directory ?

No because they aren't part of the JDK.

They will be in servlet.jar which is shipped with J2EE/JEE
runtime servers like Tomcat, Glassfish/SJSAS, JBoss, OC4J etc.

If you have the Eclipse bundle for JEE developers, you should
be able to go into Window->Preferences->Server->Installed Runtimes
and add the appropriate server runtime for your J2EE/JEE server.
Then in your project properties, you can add that runtime as a
library to your build path.

Now if I could only figure out how to make it see the source for
javax.servlet.* so I could see Javadoc in the content assist for
those packages I would be a happy man -- or at least less grumpy.

--Bill Davidson
Re: eclipse can't find javax.servlet [message #217320 is a reply to message #217262] Thu, 10 July 2008 13:07 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Bill Davidson wrote:
> Adam Posner wrote:
>> I just downloaded ganymede, I'm trying to do a simple tutorial, but am
>> getting this error. I have my Window->Peferences->Installed JREs set to
>> /usr/lib/jdk/jre. Here's my /etc/eclipse/java_home:
>>
>> Shouldn't it find these classes in the /usr/lib/jdk directory ?
>
> No because they aren't part of the JDK.
>
> They will be in servlet.jar which is shipped with J2EE/JEE
> runtime servers like Tomcat, Glassfish/SJSAS, JBoss, OC4J etc.
>
> If you have the Eclipse bundle for JEE developers, you should
> be able to go into Window->Preferences->Server->Installed Runtimes
> and add the appropriate server runtime for your J2EE/JEE server.
> Then in your project properties, you can add that runtime as a
> library to your build path.
>
> Now if I could only figure out how to make it see the source for
> javax.servlet.* so I could see Javadoc in the content assist for
> those packages I would be a happy man -- or at least less grumpy.

For Tomcat, see:

http://wiki.eclipse.org/WTP_Tomcat_FAQ#How_do_I_make_the_Ser vlet_and_JSP_API_Javadoc_in_my_Tomcat_installation_accessibl e_within_Eclipse.3F

Cheers,
Larry

>
> --Bill Davidson
>
>
Re: eclipse can't find javax.servlet [message #217358 is a reply to message #217320] Thu, 10 July 2008 22:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bill.davidson.gmail.com

Larry Isaacs wrote:
> For Tomcat, see:
>
> http://wiki.eclipse.org/WTP_Tomcat_FAQ#How_do_I_make_the_Ser vlet_and_JSP_API_Javadoc_in_my_Tomcat_installation_accessibl e_within_Eclipse.3F

Thanks. I was trying to figure this out from the project
explorer and of course that didn't work. There seems to
be a lot of options I've never seen before in the package
explorer. I guess it's time to stop ignoring it. :)
Re: eclipse can't find javax.servlet [message #217385 is a reply to message #217358] Fri, 11 July 2008 00:37 Go to previous message
Eclipse UserFriend
Originally posted by: bill.davidson.gmail.com

Bill Davidson wrote:
> Larry Isaacs wrote:
>> For Tomcat, see:
>>
>> http://wiki.eclipse.org/WTP_Tomcat_FAQ#How_do_I_make_the_Ser vlet_and_JSP_API_Javadoc_in_my_Tomcat_installation_accessibl e_within_Eclipse.3F
>
>
> Thanks. I was trying to figure this out from the project
> explorer and of course that didn't work. There seems to
> be a lot of options I've never seen before in the package
> explorer. I guess it's time to stop ignoring it. :)

Of course, after getting it all working nicely, I couldn't leave
well enough alone and I tried to upgrade from Europa to Ganymede.
The nice javadoc descriptions that used to pop up during content
assist have disappeared entirely (not just for Tomcat -- also the
JRE and even the current source file that I'm editing itself) and
I can't find the check box or whatever to turn them back on.

--Bill Davidson
Previous Topic:JSDT - jsDoc not used for code completion?
Next Topic:Project Dependency Error
Goto Forum:
  


Current Time: Thu Apr 18 02:55:36 GMT 2024

Powered by FUDForum. Page generated in 0.01902 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top