How can I add Java to a non-Java app?
Your application needs a particular Java version but it isn't a Java or JVM app.
Applications in languages other than Java can install a particular JVM using the heroku-jvm-common buildpack.
Add this buildpack to the start of the buildpacks list in your app:
$ heroku buildpacks:add -i 1 https://github.com/heroku/heroku-buildpack-jvm-common.git
This is a utility buildpack that only installs Java, so it doesn't require the app to be written in Java. But it does require a
system.properties file in the app to specify the Java version to install.
Add a file to your project called
system.properties, you can add the version of Java you need. Consult the Dev Center article here for the exact format of the file and the Java versions supported.