Downgrading Existing Java Apps to Use Java 7

Last Updated: 18 December 2014

java jdk

Table of Contents

By default, Java apps running on the cedar-14 stack use OpenJDK 8. However, it’s possible to run older versions of the JVM. Follow the instructions below to use OpenJDK 7.

If you have questions about Java on Heroku, consider discussing them in the Java on Heroku forums.


Add to your app

Create a file in the base directory of your app called

Add the property, java.runtime.version=1.7.

Currently, supported versions are 1.6, 1.7, and 1.8. The default is 1.8.


$ git add

$ git commit -m "Adding Java 7 support"

Update your PATH

$ APP_PATH=`heroku config:get PATH`
$ heroku config:set PATH=/app/.jdk/bin:$APP_PATH
Setting config vars and restarting quiet-escarpment-6377... done, v9
PATH: /app/.jdk/bin:/usr/local/bin:/usr/bin:/bin

Push your app

$ git push heroku master

You should see Installing OpenJDK 1.7 in your build output, e.g.

-----> Heroku receiving push
-----> Java app detected
-----> Installing OpenJDK 1.7...done