javaherokuweb-applicationsdeploymentprocfile

Heroku, Java Web app - free dynos Procfile - How to create proper Procfile


I'm trying to upload my 1st Java Web app to the web but I can't handle the Procfile. After deploy, there is info about successfully deploy but when I try to run the app there are an error and server logs seems to indicate that Procfile is empty / does not exist.

In server resources there is following dyno:

java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war

and in thetutorial there is "Your Procfile will look something like this:"

web: java $JAVA_OPTS -cp target/classes:target/dependency/* HelloWorld

but I don't udnerstand what is happening here. I know only that there should be web: at the beggining for web-app I don't understand the rest of it. Can some one help me undrstand it so I could create proper Procfile for my app?


Solution

  • If you have heroku installed and if you have only .jsp and .class you can do as it follows, and you don't need a procfile:

    $ heroku create <app_name>

    Create a WAR file of your app in Eclipse for example: Right click on the project > Export > WAR file

    then you have to deploy it to heroku:

    $ heroku war:deploy <path_to_war_file> --app <app_name>
    

    then you'll see the app going to heroku, some logs and blah blah blah. After that you can open your application:

    $ heroku open --app <app_name>
    

    Simple. But if you need some help about procfile, take a look here