
Deploy modern JVM-based apps
Polyglot JVM Platform for modern apps
Deploy
Deploy using Git, GitHub or directly from your CI system using precompiled builds with tools like SBT or Maven. Regardless of how your source is delivered, Heroku runs it in a dyno – a smart, secure, curated container with your choice of JVM version.
Manage
Manage your portfolio of apps in a single view using a straightforward Dashboard. Instantly see what version of your app is deployed and rollback to a stable version without recompiling. Manage your app’s environment specific configurations with external config vars.
Scale
Heroku’s horizontally scalable, share-nothing architecture is perfect for apps built with modern frameworks like Play, that are async, stateless and non-blocking. Heroku makes scaling out or up as simple as dragging a slider in the Dashboard or using a single CLI command.
Monitor
View detailed memory and garbage collection metrics in your Dashboard with JVM runtime metrics. Connect remote debuggers and inspection tools like VisualVM, or generate heap and thread dumps on demand to help track down even the most elusive bugs.
Get started now with Java on Heroku
Java/Spring
Deploying Java apps with Heroku
- Initialize the local Git repository
spring init
initializes the Java project- Specify the Java version
- Create a Controller to respond to requests with “Hello Heroku!”
- Create and deploy the app to Heroku
- We’re live!
curl https://morning-earth-85743-7d592a8d2dd3.herokuapp.com
Scala/Play
Deploying Scala apps with Heroku
- Initialize the local Git repository
sbt new
initializes the Scala project- Specify the Java version
- Generate a Play! application secret
- Configure Play! allowed hosts filter
- Create and deploy the app to Heroku
- We’re live!
curl https://radiant-shelf-38588-bdcb08e1f9ef.herokuapp.com
Why JVM Languages on Heroku?
Choice of language and framework
Build microservices with Groovy and Ratpack, reactive APIs using Scala and Play, web apps with minimal fuss using Spark and high performance web apps with Spring Boot/Spring Cloud. Heroku provides buildpacks for Java, Scala, Play, Clojure, Gradle and Grails.
Curated language stacks, intelligent defaults
Get early access to the latest JDK as soon as it’s available. Heroku runs your app on the latest stable version, Java 8, by default. Heroku sets intelligent defaults for your max heap size and stack size based on the size of the dyno smart container your app is running in.
Extend your apps with 200+ Add-ons
Heroku add-ons like CloudAMQP, Postgres, Redis, Treasure Data (Hadoop as a service) and GrapheneDB (Neo4J as a service) allow you to extend, manage and deploy modern JVM-based applications without operational overhead.
Built-in debugging and inspection tools
Heroku’s Metrics dashboard helps you identify many kinds of performance problems, while key language specific metrics, like garbage collection activity and memory usage, are included in Heroku’s Language runtime metrics dashboard. After you’ve identified an issue, you can use Heroku Exec to connect to a running dyno via SSH.
Java on Heroku
“Whether you are a business or a hobby developer, the JVM offers a mature and reliable platform to power your apps. You can choose the programming language that works best for the task at hand because of the ployglot nature of the JVM. Heroku offers extensive support for this ecosystem, enabling you to operate your business or side-project with confidence.”

Popular Add-ons
Add-ons are fully-managed services, integrated for use with Heroku, which provide services for logging, caching, monitoring, persistence and more.
View All Add-ons
Heroku Kafka
Data Stores
Heroku Postgres
Data Stores

New Relic APM
Monitoring

Snyk
Security

Rollbar
Errors and Exceptions
Heroku Java Support FAQ
How does Heroku manage Java dependencies?
Heroku automates Java dependency management by using your project’s build tool. While the default build system is Maven, Heroku also provides full support for Gradle. During deployment, the buildpack detects your build file (pom.xml
for Maven or build.gradle
for Gradle) and automatically runs a build. This process downloads all the required dependencies from their respective repositories (like Maven Central) before compiling your code, ensuring a reliable and repeatable build.
What is the fastest way to deploy a sample Java application to Heroku?
The fastest way to get started is by following the official Getting Started on Heroku with Java guide in the Heroku Dev Center. This tutorial provides a sample application and walks you through the steps of cloning the repository, provisioning a Heroku app, and deploying your code with a simple git push heroku main
command.
Which Java versions are supported on Heroku?
Heroku’s policy is to support all Java versions that are not End-of-Life (EOL), including all current non-EOL Long-Term Support (LTS) releases of the OpenJDK.
You can specify your desired Java version by creating a system.properties
file in the root of your application and setting the java.runtime.version
property. For example, to use Java 21, your file would contain: java.runtime.version=21
.
It is strongly recommended to always explicitly configure the required version for your application. If you don’t, the default version will be used, which can change over time and may cause future builds of your application to fail.
What are the most popular Java frameworks to deploy on Heroku?
Heroku supports a wide variety of frameworks from the Java ecosystem, from established leaders to modern, cloud-native options. The most popular choice is Spring Boot, which is excellent for building everything from monolithic applications to microservices. Additionally, cloud-native frameworks like Quarkus and Micronaut are increasingly popular on the platform due to their fast startup times and low memory footprints.
Does Heroku support both Maven and Gradle for building Java applications?
Yes. Heroku provides full support for both Maven and Gradle, with Maven being the default build tool for Java applications. During deployment, the buildpack automatically detects which build tool your project is using by looking for either a pom.xml
file (for Maven) or a build.gradle
file (for Gradle) in your project’s root directory. This auto-detection means you don’t need any special configuration to use your preferred build tool.
Do I need to compile my Java code and build a JAR file before deploying to Heroku?
No. For a standard deployment, you should push your Java source code directly to Heroku. The platform is designed to handle the entire build process for you. When you deploy, the Java buildpack runs your build tool (Maven or Gradle) to compile your code and create a runnable application. This source-based workflow ensures a clean and repeatable build every time and means you don’t need to commit compiled artifacts to your Git repository.
For workflows that require building on your own infrastructure, Heroku also provides tools to deploy pre-built JAR or WAR files directly.
Can I deploy applications written in other JVM languages like Scala, Kotlin, or Clojure on Heroku?
Yes. Heroku’s Java support is fundamentally support for the Java Virtual Machine (JVM). This means that any language that compiles to JVM bytecode and uses a standard build tool like Maven, Gradle, sbt, or Leiningen can be deployed on the platform. This includes popular JVM languages like Scala, Clojure, and Kotlin. You can manage your project with a pom.xml
or build.gradle
file just as you would with a standard Java application, and Heroku’s buildpack will handle the rest.
Ready to Get Started?
Stay focused on building great data-driven applications and let Heroku tackle the rest.