File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant not finding jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant not finding jar file" Watch "Ant not finding jar file" New topic

Ant not finding jar file

J McCarch

Joined: Jan 08, 2007
Posts: 9
I am trying to build Java 7 from the Oracle source code; in Java 7 part of the build uses Ant. The build is proceeding OK until, in the JAXP section, I get an error:

java7/jaxp/build.xml:105: Problem: failed to create task or type replaceregexp

Cause: the class was not found.
This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
-a directory added on the command line with the -lib argument

I found a jar file with the class - ant-nodeps-1.7.1.jar.

(I am using Ant 1.7.1)

I put this in /usr/share/ant/lib, but when I rerun I continue to get the same error. I tried several tweaks to try to get it to look in the jar, to no avail.

I haven't done much with Ant before (avoid it like the plague, actually, as I despise the whole programming-by-xml concept) but I am trying to get this built. The documentation for Ant doesn't seem to say anything about how classpath is selected and googling has been largely useless.

If there are any Ant experts who can explain what the problem is here, your help would be welcome.
Peter Johnson

Joined: May 14, 2008
Posts: 5852

Hmm, adding the JAR to Ant's lib directory should have worked. Try running the Ant script with the -b or -v options and see if that gives more information.

Another thought - does the JVM source come with embedded Ant? If so, then it will be using that copy and not the one that you installed.

JBoss In Action
J McCarch

Joined: Jan 08, 2007
Posts: 9
I finally got around this by unjarring and combining the ant and ant-devel jars into one new ant.jar and placing it in that directory. Hope I don't need to upgrade ant anytime soon.
I agree. Here's the link:
subject: Ant not finding jar file
jQuery in Action, 3rd edition