You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Bill Siggelkow <bi...@bellsouth.net> on 2003/09/21 02:24:35 UTC

Problem with Ant Integration (and workaround)

I recently had a wierd problem with the Cactus-Ant Integration.  I am using
the 1.6dev-20030907 ant integration jar.  Anyway, the problem I had was with
the "cactus" task (attempting to start Tomcat).  When I ran the Ant script
from within Eclipse it failed with the error "Couldn't find tools.jar ...".
However, when I ran the script from the command-line it worked fine.  I
traced the problem down to the getToolsJar method of the
AbstractJavaContainer class.  Basically, what this method does is try to
locate the "tools.jar" in the following location:

[java.home]/../lib/tools.jar

This works fine if "java.home" is pointing to something like
C:\j2dsk1.4.2\jre ... However when running in Eclipse my "java.home" was
C:\Program Files\Java\jre -- and, consequently, the tools.jar couldn't be
found.  My quick-and-dirty workaround was to create the following a 'lib'
folder under C:\Program Files\Java and copy the tools.jar there.  It seems
like the getToolsJar method could be made a little smarter to handle this
situation.


Re: Problem with Ant Integration (and workaround)

Posted by Bill Siggelkow <bi...@bellsouth.net>.
Thanks for the info, Vincent.  The "javac" task works for me under Eclipse
because I have included the tools.jar in the Ant runtime classpath
(Window->Preferences->Ant->Runtime) so the javac task must be using a
different mechanism to locate the tools.jar.  I will try and find the time
to take investigate this and submit a patch -- right now my 3-year-old wants
to color -- priorities :)

----- Original Message ----- 
From: "Vincent Massol" <vm...@pivolis.com>
To: "'Cactus Users List'" <ca...@jakarta.apache.org>
Cc: "'Bill Siggelkow'" <bi...@bellsouth.net>
Sent: Sunday, September 21, 2003 2:13 AM
Subject: RE: Problem with Ant Integration (and workaround)


> Hi Bill
>
> This is a known problem in Eclipse :-) It's the same if you use the
> <javac> task in Ant. It will fail under default Eclipse. Because, by
> default Eclipse configures the JRE and not the JDK. I heard they're
> going to change something in future versions.
>
> That said, you're right, we should definitely improve the getToolsJar.
> We'd be happy to get a patch if you have some time...
>
> Thanks
> -Vincent
>
> > -----Original Message-----
> > From: Bill Siggelkow [mailto:billsigg@bellsouth.net]
> > Sent: 21 September 2003 02:25
> > To: cactus-user@jakarta.apache.org
> > Subject: Problem with Ant Integration (and workaround)
> >
> > I recently had a wierd problem with the Cactus-Ant Integration.  I am
> > using
> > the 1.6dev-20030907 ant integration jar.  Anyway, the problem I had
> was
> > with
> > the "cactus" task (attempting to start Tomcat).  When I ran the Ant
> script
> > from within Eclipse it failed with the error "Couldn't find tools.jar
> > ...".
> > However, when I ran the script from the command-line it worked fine.
> I
> > traced the problem down to the getToolsJar method of the
> > AbstractJavaContainer class.  Basically, what this method does is try
> to
> > locate the "tools.jar" in the following location:
> >
> > [java.home]/../lib/tools.jar
> >
> > This works fine if "java.home" is pointing to something like
> > C:\j2dsk1.4.2\jre ... However when running in Eclipse my "java.home"
> was
> > C:\Program Files\Java\jre -- and, consequently, the tools.jar couldn't
> be
> > found.  My quick-and-dirty workaround was to create the following a
> 'lib'
> > folder under C:\Program Files\Java and copy the tools.jar there.  It
> seems
> > like the getToolsJar method could be made a little smarter to handle
> this
> > situation.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>


RE: Problem with Ant Integration (and workaround)

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Bill

This is a known problem in Eclipse :-) It's the same if you use the
<javac> task in Ant. It will fail under default Eclipse. Because, by
default Eclipse configures the JRE and not the JDK. I heard they're
going to change something in future versions.

That said, you're right, we should definitely improve the getToolsJar.
We'd be happy to get a patch if you have some time...

Thanks
-Vincent

> -----Original Message-----
> From: Bill Siggelkow [mailto:billsigg@bellsouth.net]
> Sent: 21 September 2003 02:25
> To: cactus-user@jakarta.apache.org
> Subject: Problem with Ant Integration (and workaround)
> 
> I recently had a wierd problem with the Cactus-Ant Integration.  I am
> using
> the 1.6dev-20030907 ant integration jar.  Anyway, the problem I had
was
> with
> the "cactus" task (attempting to start Tomcat).  When I ran the Ant
script
> from within Eclipse it failed with the error "Couldn't find tools.jar
> ...".
> However, when I ran the script from the command-line it worked fine.
I
> traced the problem down to the getToolsJar method of the
> AbstractJavaContainer class.  Basically, what this method does is try
to
> locate the "tools.jar" in the following location:
> 
> [java.home]/../lib/tools.jar
> 
> This works fine if "java.home" is pointing to something like
> C:\j2dsk1.4.2\jre ... However when running in Eclipse my "java.home"
was
> C:\Program Files\Java\jre -- and, consequently, the tools.jar couldn't
be
> found.  My quick-and-dirty workaround was to create the following a
'lib'
> folder under C:\Program Files\Java and copy the tools.jar there.  It
seems
> like the getToolsJar method could be made a little smarter to handle
this
> situation.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org