# Installing XOM

XOM is a library. By itself, it doesn't do much of anything. It exists only to be used by other programs. It requires Java 1.6 or later.

XOM's Maven group ID is "xom" and its artifact ID is "xom". To add a dependency on XOM using Maven, add this dependency element to your `pom.xml`:

    <dependency>
      <groupId>xom</groupId>
      <artifactId>xom</artifactId>
      <version>1.4.1</version>
    </dependency>

To add a dependency using Gradle:

    dependencies {
      implementation 'xom:xom:1.4.1'
    }

If you are not using a build tool like Maven or Gradle, you can install XOM manually by placing the XOM JAR archive somewhere in your `CLASSPATH`. This archive is the file named something like `xom-1.4.1.jar`. (The version number may have changed if I've forgotten to update this document.) You can either put it in your `jre/lib/ext` directory, add `xom-1.4.1.jar` to your `CLASSPATH` environment variable, or use the `-classpath` option when invoking `javac` and `java`.

To check your download you can run one of the sample programs found in the `xom-samples.jar` file. For instance, nu.xom.samples.PrettyPrinter class formats an XML document by inserting and removing white space around element boundaries. You can run it from the command line like this:

    $ java -classpath xom-samples.jar:xom-1.4.1.jar nu.xom.samples.PrettyPrinter filename.xml

Elliotte Rusty Harold
ERH
2005, 2016, 2019, 2020, 2023, 2026 Elliotte Rusty Harold