Common Java Cookbook

Edition: 0.19

Download PDF or Read on Scribd

Download Examples (ZIP)

10.12. Obtaining Jakarta ORO

10.12.1. Problem

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

10.12.2. Solution

To use Jakarta ORO in a Maven 2 project, add the following dependency to your project's pom.xml:

Example 10.2. Adding a Dependency on Commons ORO

    <dependency>
      <groupId>oro</groupId>
      <artifactId>oro</artifactId>
      <version>2.0.8</version>
    </dependency>

If you are not sure what this means, I'd suggest reading Maven: The Definitive Guide. When you depend on a library in Maven 2, all you need to do is add the dependency groupId, artifactId, and version to your project's dependencies. Once you do this, Maven 2 will download the dependency and make it available on your project's classpath.

10.12.3. 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 supports regular expressions, ORO still remains relevant for developers who need specific support for Perl5 extended regular expressions.

10.12.4. 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.


Creative Commons License
Common Java Cookbook by Tim O'Brien is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.
Permissions beyond the scope of this license may be available at http://www.discursive.com/books/cjcook/reference/jakartackbk-PREFACE-1.html. Copyright 2009. Common Java Cookbook Chunked HTML Output. Some Rights Reserved.