--- layout: documentation --- # Getting Started with Bazel ## Setup Use the [installation instructions](/docs/install.html) to install a copy of Bazel on your machine. ## Using a workspace All Bazel builds take place in a [_workspace_](/docs/build-ref.html#workspaces), a directory on your filesystem that contains source code for the software you want to build, as well symbolic links to directories that contain the build outputs (for example, `bazel-bin` and `bazel-out`). The location of the workspace directory is not significant, but it must contain a file called `WORKSPACE` in the top-level directory. The `WORKSPACE` file may be an empty file, or it may contain references to [external dependencies](/docs/external.html) required to build the outputs. One workspace can be shared among multiple projects if desired. To get started, we'll focus on a simple example with one project. Suppose that you have an existing project in a directory, say, `~/gitroot/my-project/`. Create an empty file at `~/gitroot/my-project/WORKSPACE` to show Bazel where your project's root is. ## Creating Your Own Build File Use the following commands to make a small Java project for this example: {% highlight bash %} $ # If you're not already there, move to your workspace directory. $ cd ~/gitroot/my-project $ mkdir -p src/main/java/com/example $ cat > src/main/java/com/example/ProjectRunner.java < src/main/java/com/example/Greeting.java < src/main/java/com/example/cmdline/Runner.java <_deploy.jar`): {% highlight bash %} $ bazel build //src/main/java/com/example/cmdline:runner_deploy.jar INFO: Found 1 target... Target //src/main/java/com/example/cmdline:runner_deploy.jar up-to-date: bazel-bin/src/main/java/com/example/cmdline/runner_deploy.jar INFO: Elapsed time: 1.700s, Critical Path: 0.23s {% endhighlight %} `runner_deploy.jar` will contain all of its dependencies. ## Next Steps You can now create your own targets and compose them. Next, check out the [tutorial](/docs/tutorial/index.html) to learn how to build a server backend, Android app, and iOS app with Bazel. Also see the [build encyclopedia](be/overview.html) and [user manual](bazel-user-manual.html) for more information. [Let us know](https://groups.google.com/forum/#!forum/bazel-discuss) if you have any questions!