Upgrading your Play app to a newer version


Let’s assume you have an existing app using Play! 2.1.A and a 2.1.B version was released. You want to update your environment to use that new release. Note: This tutorial was tested to be working with 2.1.* versions; A and B are two arbitrary numbers.


Running and debugging your Play app


Running locally

  • play run will start the local (Netty) server and your app will be available at localhost:9000.
  • play ~run will start the local server and reload it automatically every time you change a file of you app, that way you don’t need to hit refresh (F5) on your browser.
  • Useful tip: If you don’t want to have to worry about applying evolutions each time you restart Play, add applyEvolutions.your_database_name=true to your application.conf file. For instance, considering the default database, you should add applyEvolutions.default=true.

Debugging using Eclipse

  1. First you must start the Play! app in debug mode by executing the command play debug run.
  2. On Eclipse add your breakpoints as you would normally do.
  3. Then go to Run > Debug Configurations... and double-click Remote Java Application. This will add a new configuration.
  4. On Connect tab, find Connection properties and change Port to 9999.
  5. On Common tab, check Debug so that it later appears below the Debug icon. Click Apply. Click Debug.

That’s it! Check this video for a live explanation.


Creating your first Play 2.1 app


Follow the official install instructions (these steps will only work for 2.1.* versions of the Play Framework). Afterwards:

  1. play new myFirstApp creates a new app, in the current directory, inside a new folder called myFirstApp
  2. Now try to run it. First go inside that folder (cd myFirstApp), and run it (play).
  3. [Optional step] You can transform your Play application into an Eclipse project, by running play eclipse. If you want Play’s source files and javadoc to be attached to the Eclipse project, you should execute play "eclipse with-source=true" instead.

Installing Play Framework 2.1 on Windows


The Play Framework is probably one of the few web frameworks that installs and works pretty well on Windows. I started web development with Django, but I had to learn Python and Django at the same time, and the documentation was not so good as they said it was. So I decided to leverage my Java experience and use Play. And since Play supports both Java and Scala I could refactor and move to Scala at any time.

Overview of Play Framework
Overview of Play Framework

On this guide I’ll just refer to these variables and not their absolute paths:

  • %JAVA_HOME%, where Java installer installs JDK, e.g. C:\Program Files (x86)\Java\jdk1.7.0_25\bin
  • %PLAY_HOME%, where you extract the Play! Framework files, e.g. C:\Play\play-2.1.2

To install Play just follow these steps: