Deep-dive on the Next Gen Platform. Join the Webinar!

Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Troubleshooting Node.js Apps
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Working with AI
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Language Support
  • Java
  • Working with Java
  • Deploying JAR and WAR Files

Deploying JAR and WAR Files

Last updated February 24, 2025

Table of Contents

  • Requirements and Installation
  • Authentication
  • Deploying an Executable JAR file
  • Deploying a WAR File
  • Configuring OpenJDK Version
  • Automatically Included Files and Directories

You can package many JVM applications into a self-contained executable JAR file or a WAR file that includes application code, configuration, and dependencies. As an alternative to Git deployments, Heroku offers a command-line tool to deploy JAR and WAR files directly.

This deployment strategy can be useful when Git deployments result in apps that exceed the size limit. You can also use this deployment to build and test your app on existing continuous integration (CI) infrastructure such as Jenkins before deploying to Heroku.

Requirements and Installation

The Heroku JVM Application Deployer requires OpenJDK 8 or later installed on the machine deploying the app.

Download the Heroku JVM Application Deployer JAR file from the latest release on GitHub.

Authentication

The Heroku JVM Application Deployer uses Heroku’s Platform API and needs an API key to function. If you installed the Heroku CLI and are logged in with heroku login, the deployer automatically picks up your API key.

If you haven’t installed the Heroku CLI, the deployer attempts to read the Heroku API key from the HEROKU_API_KEY environment variable.

Deploying an Executable JAR file

The following command will deploys the JAR file to Heroku. The command generates and deploys a Procfile that runs the deployed JAR file with java -jar.

java -jar heroku-jvm-application-deployer.jar --app=nameless-dusk-88303 /path/to/app.jar

You can only run JAR files with a Main-Class attribute in the JAR manifest with java -jar . If you can’t run your JAR file via java -jar, you must provide a custom Procfile.

-----> Packaging application...
       - including: Procfile (hidden)
       - including: test-1.0-SNAPSHOT-jar-with-dependencies.jar
-----> Creating build...
       - file: /tmp/heroku-deploy3032832562328358957source-blob.tgz
       - size: 3MB
-----> Uploading build...
       Uploaded 4 KB/3 MB (0.1%, 4 KB/s)
       Uploaded 1 MB/3 MB (50.6%, 1 MB/s)
       Uploaded 2 MB/3 MB (90.3%, 1 MB/s)
       - success (3.1 seconds)
-----> Deploying...
remote:
remote: -----> Building on the Heroku-24 stack
remote: -----> Using buildpack: heroku/jvm
remote: -----> JVM Common app detected
remote: -----> Installing OpenJDK 21... done
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 76.4M
remote: -----> Launching...
remote:        Released v6
remote:        https://nameless-dusk-88303-9d9b2a3590bf.herokuapp.com/ deployed to Heroku
remote:
-----> Done

Deploying a WAR File

Deploying a WAR file works the same way as deploying an executable JAR file. The deployer downloads the latest release of Heroku’s Webapp Runner for you and deploys it with your WAR file.

The deployer also generates and deploys a Procfile that uses Webapp Runner to run your WAR file.

java -jar heroku-jvm-application-deployer.jar --app=nameless-dusk-88303 /path/to/app.war

-----> Downloading webapp-runner 10.1.28.0...
-----> Packaging application...
       - including: Procfile (hidden)
       - including: test-1.0-SNAPSHOT.war
       - including: .heroku/webapp-runner.jar
-----> Creating build...
       - file: /tmp/heroku-deploy7572390222443658138source-blob.tgz
       - size: 24MB
-----> Uploading build...
       Uploaded 4 KB/24 MB (0.0%, 4 KB/s)
       Uploaded 23 MB/24 MB (96.0%, 24 MB/s)
       - success (1.2 seconds)
-----> Deploying...
remote:
remote: -----> Building on the Heroku-24 stack
remote: -----> Using buildpack: heroku/jvm
remote: -----> JVM Common app detected
remote: -----> Installing OpenJDK 21... done
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 97.6M
remote: -----> Launching...
remote:        Released v8
remote:        https://nameless-dusk-88303-9d9b2a3590bf.herokuapp.com/ deployed to Heroku
remote:
-----> Done

Configuring OpenJDK Version

The deployer supports the same OpenJDK versions as defined in Heroku Java Support Reference. It also uses the same default version. To configure the OpenJDK version, use the --jdk flag:

java -jar heroku-jvm-application-deployer.jar --jdk 21 --app=nameless-dusk-88303

This command generates and deploys a system.properties file with the configured OpenJDK version. If a system.properties file exists in the current working directory, the deployer deploys and uses this file instead.

Automatically Included Files and Directories

The Heroku JVM Application Deployer automatically includes certain files and directories from the current working directory if they’re present. These files are:

  • Procfile (See: Procfile)
  • system.properties (See: Heroku Java Support)
  • .jdk-overlay (See: Customizing the JDK)

To disable the automatic inclusion of these files, pass the --disable-auto-includes flag.

Keep reading

  • Working with Java

Feedback

Log in to submit feedback.

Warming Up a Java Process Deploying Tomcat-based Java Web Applications with Webapp Runner

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices