My Rails app relies on legacy Java code for a piece of its logic. It runs the code via shell commands: javac whatever and then java whatever. However,
Try using heroku-buildpack-jvm-common instead of the Java buildpack. So your .buildpacks file will look like this:
https://github.com/heroku/heroku-buildpack-jvm-common.git
https://github.com/heroku/heroku-buildpack-ruby.git
It's probably a good idea to put the JVM one before the Ruby one in case javac or java are needed at compile/build time.
The JVM buildpack is essentially the same as the Java buildpack, but doesn't install Maven and thus does not require a pom.xml file. The missing pom.xml is why you got that error I think.
EDIT
In the modern era, you can also run:
$ heroku buildpacks:add heroku/jvm
$ heroku buildpacks:add heroku/ruby