Play 2 Java Tutorial

Update: This tutorial is a bit old. For more up-to-date tutorials see: https://www.playframework.com/documentation/2.3.x/Tutorials

I’ve created a Play 2 Tutorial and posted it on GitHub! The tutorial covers how to:

Each section has a corresponding branch in git so you can diff against my version to see if you’ve done everything correctly. Right now this is just for Play 2 with Java and Ebean but I’m working on doing this for Play 2 with Scala as well.

You can see a live demo of the final app at:
play2torial.herokuapp.com

It’s a pretty simple app but it should get you started building Play 2 apps and deploying them on the cloud with Heroku. If you want to take the shortcut to the end and get your own copy of the app running on Heroku then just do the following:

  1. Install git and the Heroku Toolbelt.
  2. Signup for an account on Heroku. (Don’t worry, this stuff is free.)
  3. Clone the play2torial git repo:
    git clone git://github.com/jamesward/play2torial.git
  4. Login to Heroku:
    heroku login
  5. Create a new app on Heroku (from within the play2torial directory):
    heroku create
  6. Upload the app to Heroku (from within the play2torial directory):
    git push heroku origin/java-heroku_update:refs/heads/master
  7. Check out your app on the cloud:
    heroku open
  8. If you want to run the app locally, install Play 2 and then run:
    git checkout java-heroku_update
    play ~run

I hope this helps you learn Play 2! Let me know if you have any questions or comments. Thanks!