# How to build {OpenGrok

The easiest way to build (or modify) {OpenGrok is by using NetBeans, but you can also build {OpenGrok from the command line.

## Requirements

You need the following:

- JDK 1.6 or higher
- Apache Ant 1.8 or later if you don't intend to build using NetBeans
- The source code is located in a Mercurial repository
- The analyzers are generated from lex by using JFlex

## Check out the source

The first thing you need to do is to check out the source code. You might do this from within NetBeans if you have the Mercurial plugin installed, or you can check out the source with the following command:

    git clone https://github.com/OpenGrok/OpenGrok

## Prepare the source for compilation

Copy `JFlex.jar` into the `lib` directory in the OpenGrok source. (If you are using NetBeans, you could alternatively add JFlex.jar to Ant's classpath at Tools->Options->Miscellaneous->Ant. If you are running Ant from the command line, it should also work if you put JFlex.jar into your `~/.ant/lib` directory.)

## Compile the source

If you use NetBeans you should be able to open OpenGrok as a project and build it from there. If you want to build from the command line, execute the following command:

    ant

If the build is successful, you should now find the binaries under the `dist` directory.