Let me give you a gist about what is Heroku Enterprise. It a Platform-as-a-Service. You can build custom applications in open-source languages like Java, Ruby, Python, PHP, JavaScript, and Go using Heroku. You can also use Heroku to deploy, manage, and scale your apps.

Here we will learn how to run a java application on Heroku.

Before getting started, you need to understand that, all Heroku applications run in a collection of lightweight Linux containers called dynos.

Types of Dynos:

  • Free
  • Hobby
  • Standard and
  • Performance dynos

You can add more than one dynos. By default, your app is deployed on a free dyno.

Every dyno belongs to one of the three following configurations:

  • Web: Web dynos handle HTTP requests. It receive HTTP traffic from the routers.
  • Worker: Worker dynos are used for background jobs, queueing systems, and timed jobs.
  • One-off: One-off dynos are used to handle administrative tasks, such as database migrations and console sessions.

Example: Adding multiple web dynos, allows you to handle more concurrent HTTP requests, and therefore higher volumes of traffic.

Sign Up for a Heroku Account

If you do not have heroku account yet, then create a free account by visiting signup.heroku.com.


Once you’ve installed the Heroku Toolbelt CLI tools, you can use the heroku command from your command shell.

Let’s get started

  1. Open up a Command Line terminal window and execute a login command:

heroku login

Enter your Heroku credentials.

Command to check which user is logged in to the Heroku Toolbelt:

heroku auth:whoami

  1. Assuming that your application is uploaded on git. To quickly get started and follow along, you can clone the following application repository or your application own repository so that you have a local version of the code by executing the following commands:

git clone [Git Application Link]
cd [Application Name same as in Git]

git clone https://github.com/heroku/java-getting-started.git

cd java-getting-started

Note: If you are cloning your application repository, then remember to replace the git link and folder name in above git clone and cd command respectively.

  1. Deploy your repository to a Heroku app
    1. Command to create a Heroku app:
      heroku create APP_NAME
      If you do not specify app name then Heroku generates a random name (in this case peaceful-basin-92539) for your app.
    2. Command to deploy your code:
      git push heroku master

The application is now deployed.

  1. Scaling Your App
    1. Ensure that at least one instance of the app is running by executing this command:
      heroku ps:scale web=1
    2. Now visit the app at the URL generated by its app name.

Alternatively, you can open the website using following command:

heroku open

Lets just scale the app down so it’s not running. Enter the following command:

heroku ps:scale web=0

Go ahead and open your app on the web. With no web dynos running, your app is not being served on the web.

So let’s scale back up to one web dyno using the Toolbelt:

heroku ps:scale web=1

Different dyno types have different limits to which they can be scaled. See Default scaling limits.

You can view some details about your app right in the terminal. Command to see a list of apps that you can access:

heroku apps

Command to check the information about your new app:

heroku apps:info APP_NAME


heroku apps:info dry-shelf-92210

Congratulations! You’re running your first web application on the Heroku cloud.