A barebones Java app, which can easily be deployed to Heroku.
This application supports the Getting Started with Java on Heroku article - check it out.
Make sure you have Java and Maven installed. Also, install the Heroku CLI.
$ git clone https://github.com/heroku/java-getting-started.git
$ cd java-getting-started
$ mvn install
$ heroku local:start
Your app should now be running on localhost:5000.
If you're going to use a database, ensure you have a local .env
file that reads something like this:
JDBC_DATABASE_URL=jdbc:postgresql://localhost:5432/java_database_name
$ heroku create
$ git push heroku main
$ heroku open
For more information about using Java on Heroku, see these Dev Center articles: