<commit_before>```
:::-- rundoc
email = ENV['HEROKU_EMAIL'] || `heroku auth:whoami`

Rundoc.configure do |config|
  config.project_root = "java-getting-started"
  config.filter_sensitive(email => "<EMAIL>")
end
```
<!--
  rundoc src:
  https://github.com/jkutner/rundoc/blob/master/java-getting-started.md

  Command:
  $ rundoc build --path java-getting-started.md
-->

<h2 data-next-message="I'm ready to start">Introduction</h2>

This tutorial will have you deploying a Java app in minutes.

Hang on for a few more minutes to learn how it all works, so you can make the most out of Heroku.

The tutorial assumes that you already have:

* A free <a href="https://signup.heroku.com/signup/dc" target="_blank">Heroku account</a>
* <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank">Java 8</a> installed
* <a href="http://maven.apache.org/download.html" target="_blank">Maven 3</a> installed

If you'd prefer to use Gradle instead of Maven, please see the [Getting Started with Gradle on Heroku](getting-started-with-gradle-on-heroku) guide.

<h2 data-next-message="I have installed the Heroku CLI">Set up</h2>

>callout
>The Heroku CLI requires **Git**, the popular version control system. If you don't already have Git installed, complete the following before proceeding:
>
> * <a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" target="_blank">Git installation</a>
> * <a href="https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup" target="_blank">First-time Git setup</a>

In this step you'll install the Heroku Command Line Interface (CLI). You use the CLI to manage and scale your applications, provision add-ons, view your application logs, and run your application locally.

Download and run the installer for your platform:

<div class="cli-download">
  <div class="text-center">
    <div class="download-wrap">
      <div class="download-column panel">
        <div class="download-title"><img src="/images/cli-apple-logo.svg" class="logo" alt="apple logo" />macOS</div>
        <p>
        <a href="https://cli-assets.heroku.com/heroku.pkg" class="btn btn-primary">Download the installer</a></p>
        <p><sub>Also available via Homebrew:</sub></p>
        <pre class=" language-term"><code class=" language-term"><span class="token input"><span class="token prompt">$ </span>brew install heroku/brew/heroku</span></code></pre>
      </div>
      <div class="download-column panel">
        <div class="download-title"><img src="/images/cli-windows-logo.svg" class="logo" alt="windows logo"/>Windows</div>
        <p>Download the appropriate installer for your Windows installation:</p>
        <p>
        <a href="https://cli-assets.heroku.com/heroku-x64.exe" class="btn btn-primary">64-bit installer</a></p>
        <p><a href="https://cli-assets.heroku.com/heroku-x86.exe" class="btn btn-primary">32-bit installer</a></p>
      </div>
    </div>
    <div class="download-wrap">
      <div class="download-column panel">
        <div class="download-title"><img src="/images/cli-ubuntu-logo.svg" class="logo" alt="ubuntu logo" />Ubuntu 16+</div>
        <p>Run the following from your terminal:</p>
        <pre class=" language-term"><code class=" language-term"><span class="token input"><span class="token prompt">$ </span>sudo snap install heroku --classic</span></code></pre>
        <p><sub><a href="https://snapcraft.io">Snap is available on other Linux OS's as well</a>.
</sub></p>
      </div>
    </div>
  </div>
</div>

When installation completes, you can use the `heroku` command from your terminal.

<div class="only-windows">On Windows, start the Command Prompt (cmd.exe) or Powershell to access the command shell.</div>

Use the `heroku login` command to log in to the Heroku CLI:

```term
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
 ›   Warning: If browser does not open, visit
 ›   https://cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in... done
Logged in as <EMAIL>
```

This command opens your web browser to the Heroku login page. If your browser is already logged in to Heroku, simply click the **Log in** button displayed on the page.

This authentication is required for both the `heroku` and `git` commands to work correctly.

Note that if you’re behind a firewall that requires use of a proxy to connect with external HTTP/HTTPS services, [you can set the `HTTP_PROXY` or `HTTPS_PROXY` environment variables](articles/using-the-cli#using-an-http-proxy) in your local development environment before running the `heroku` command.

<h2 data-next-message="I cloned the app source code">Prepare the app</h2>

In this step, you will prepare a sample application that's ready to be deployed to Heroku.

>callout
>If you are new to Heroku, it is recommended that you
>complete this tutorial using the Heroku-provided sample application.
>
>However, if you have your own existing application that you want to deploy
>instead, see <a href="https://devcenter.heroku.com/articles/preparing-a-codebase-for-heroku-deployment" target="_blank">this article</a>
>to learn how to prepare it for Heroku deployment.

To create a local copy of a sample app that you can deploy to Heroku, execute the following commands in your local command shell or terminal:


```term
:::>- $ git clone https://github.com/heroku/java-getting-started
:::>- $ cd java-getting-started
```

You now have a functioning Git repository that contains a simple Java application. The application includes a `pom.xml` file, which is used by Java's dependency manager, Maven.
<commit_msg>Added branch logic to rundoc<commit_after>```
:::-- rundoc
email = ENV['HEROKU_EMAIL'] || `heroku auth:whoami`

Rundoc.configure do |config|
  config.project_root = "java-getting-started"
  config.filter_sensitive(email => "<EMAIL>")
end
```
<!--
  rundoc src:
  https://github.com/jkutner/rundoc/blob/master/java-getting-started.md

  Command:
  $ rundoc build --path java-getting-started.md
-->

<h2 data-next-message="I'm ready to start">Introduction</h2>

This tutorial will have you deploying a Java app in minutes.

Hang on for a few more minutes to learn how it all works, so you can make the most out of Heroku.

The tutorial assumes that you already have:

* A free <a href="https://signup.heroku.com/signup/dc" target="_blank">Heroku account</a>
* <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank">Java 8</a> installed
* <a href="http://maven.apache.org/download.html" target="_blank">Maven 3</a> installed

If you'd prefer to use Gradle instead of Maven, please see the [Getting Started with Gradle on Heroku](getting-started-with-gradle-on-heroku) guide.

<h2 data-next-message="I have installed the Heroku CLI">Set up</h2>

>callout
>The Heroku CLI requires **Git**, the popular version control system. If you don't already have Git installed, complete the following before proceeding:
>
> * <a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" target="_blank">Git installation</a>
> * <a href="https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup" target="_blank">First-time Git setup</a>

In this step you'll install the Heroku Command Line Interface (CLI). You use the CLI to manage and scale your applications, provision add-ons, view your application logs, and run your application locally.

Download and run the installer for your platform:

<div class="cli-download">
  <div class="text-center">
    <div class="download-wrap">
      <div class="download-column panel">
        <div class="download-title"><img src="/images/cli-apple-logo.svg" class="logo" alt="apple logo" />macOS</div>
        <p>
        <a href="https://cli-assets.heroku.com/heroku.pkg" class="btn btn-primary">Download the installer</a></p>
        <p><sub>Also available via Homebrew:</sub></p>
        <pre class=" language-term"><code class=" language-term"><span class="token input"><span class="token prompt">$ </span>brew install heroku/brew/heroku</span></code></pre>
      </div>
      <div class="download-column panel">
        <div class="download-title"><img src="/images/cli-windows-logo.svg" class="logo" alt="windows logo"/>Windows</div>
        <p>Download the appropriate installer for your Windows installation:</p>
        <p>
        <a href="https://cli-assets.heroku.com/heroku-x64.exe" class="btn btn-primary">64-bit installer</a></p>
        <p><a href="https://cli-assets.heroku.com/heroku-x86.exe" class="btn btn-primary">32-bit installer</a></p>
      </div>
    </div>
    <div class="download-wrap">
      <div class="download-column panel">
        <div class="download-title"><img src="/images/cli-ubuntu-logo.svg" class="logo" alt="ubuntu logo" />Ubuntu 16+</div>
        <p>Run the following from your terminal:</p>
        <pre class=" language-term"><code class=" language-term"><span class="token input"><span class="token prompt">$ </span>sudo snap install heroku --classic</span></code></pre>
        <p><sub><a href="https://snapcraft.io">Snap is available on other Linux OS's as well</a>.
</sub></p>
      </div>
    </div>
  </div>
</div>

When installation completes, you can use the `heroku` command from your terminal.

<div class="only-windows">On Windows, start the Command Prompt (cmd.exe) or Powershell to access the command shell.</div>

Use the `heroku login` command to log in to the Heroku CLI:

```term
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
 ›   Warning: If browser does not open, visit
 ›   https://cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in... done
Logged in as <EMAIL>
```

This command opens your web browser to the Heroku login page. If your browser is already logged in to Heroku, simply click the **Log in** button displayed on the page.

This authentication is required for both the `heroku` and `git` commands to work correctly.

Note that if you’re behind a firewall that requires use of a proxy to connect with external HTTP/HTTPS services, [you can set the `HTTP_PROXY` or `HTTPS_PROXY` environment variables](articles/using-the-cli#using-an-http-proxy) in your local development environment before running the `heroku` command.

<h2 data-next-message="I cloned the app source code">Prepare the app</h2>

In this step, you will prepare a sample application that's ready to be deployed to Heroku.

>callout
>If you are new to Heroku, it is recommended that you
>complete this tutorial using the Heroku-provided sample application.
>
>However, if you have your own existing application that you want to deploy
>instead, see <a href="https://devcenter.heroku.com/articles/preparing-a-codebase-for-heroku-deployment" target="_blank">this article</a>
>to learn how to prepare it for Heroku deployment.

To create a local copy of a sample app that you can deploy to Heroku, execute the following commands in your local command shell or terminal:


```term
:::>- $ git clone https://github.com/heroku/java-getting-started
:::>- $ cd java-getting-started
:::-- $ git checkout -t origin/$(git remote get-url heroku 2> /dev/null | sed 's/https:\/\/git.heroku.com\/\(.*\).git/\1/')
:::-- $ git checkout master
:::-- $ git merge $(git remote get-url heroku 2> /dev/null | sed 's/https:\/\/git.heroku.com\/\(.*\).git/\1/')
```

You now have a functioning Git repository that contains a simple Java application. The application includes a `pom.xml` file, which is used by Java's dependency manager, Maven.

{'fraction_non_alphanumeric': 0.1383975026014568, 'fraction_numerical': 0.003815469996531391, 'mean_word_length': 4.100840336134453, 'pattern_counts': {'":': 0, '<': 179, '<?xml version=': 0, '>': 211, 'https://': 22, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7220818', 'n_tokens_mistral': 3608, 'n_tokens_neox': 3442, 'n_words': 1212}