10.12. Obtaining Jakarta ORO

Problem

You need to use Jakarta ORO to finds files by a glob or regular expression.

Solution

Download Jakarta ORO 2.0.8 from http://jakarta.apache.org/site/binindex.cgi. Once you have downloaded and uncompressed the archive distribution, place the jakarta-oro-2.0.8.jar in your classpath.

Discussion

Jakarta ORO provides support for Perl regular expressions, AWK expressions, and glob expressions. Before Java 1.4 introduced the java.util.regex package and regular expression support in the String class, Jakarta ORO and Jakarta RegExp gave developers a way to use regular expressions in Java. Now that Java 1.4 supports regular expressions, ORO still remains relevant for developers who need specific support for Perl5 extended regular expressions.

If you have a Maven project that needs to use Jakarta ORO, add a dependency on Jakarta ORO 2.0.8 with the following section in project.xml:

<dependencies>
  <dependency>
    <id>oro</id>
    <version>2.0.8</version>
  </dependency>
  ....other dependencies...
</dependencies>

See Also

For more information about ORO, see the Jakarta ORO project at http://jakarta.apache.org/oro. For more information about the regular expression syntax supported by Jakarta ORO, see the package summary for the org.apache.oro.test.regex package at http://jakarta.apache.org/oro/api/org/apache/oro/text/regex/package-summary.html.

Get Jakarta Commons Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.