I was wondering if it's possible to run a non-web java app in Heroku from within a web java app? Basically I want to execute a command to run the non-web app jar:
Calling something like this in Heroku for one off process:
Process proc = Runtime.getRuntime().exec("java -jar A.jar");
You probably don't want to execute the new process from the existing Java process. Instead, you should create a new process type in your app's
Procfile
, like this:Then you can run the worker process from the CLI
heroku run worker
, or you can make an HTTP call to the Heroku API.I assume you are using
heroku war:deploy
, which means you probably don't have aProcfile
at this time. You may need to switch toheroku jar:deploy
and include webapp-runner in your app manually.