Documentation

You are viewing the documentation for Play 1. The documentation for Play 2 is here.

Installation guide

Prerequisites

To run the play framework, you need Java 5 or later. If you wish to build play from source, you will need the Bazaar source control client to fetch the source code and Ant to build it.

If you are using MacOS, java is just built-in. If you are using linux, make sure to use either the Sun-JDK or OpenJDK (and not gcj which is the default java command on many linux distro). If you are using Windows, just download and install the latest JDK package.

Be sure to have java in the current path (try to type java -version to check). Play will use the default java or the one available at the $JAVA_HOME path if defined.

The play command line utility uses python. So it should work out of the box on any UNIX system (however it requires at least python 2.4). If you’re running Windows, don’t worry, a python runtime is bundled with the framework.

Download the binary package

Download the latest play binary package and extract the archive. For convenience, you should add the framework installation directory to your system PATH. If you’re on UNIX, make sure that the play script is runnable (otherwise simply do a chmod +x play). That’s all.

Tip

If you need to rebuild the framework for whatever reason, run ant from the $PLAY_HOME/framework directory.

Build from the latest sources

To benefit from the latest improvements and bug fixes, you may want to compile play from sources. You’ll need a Bazaar client to fetch the sources and Ant to build the framework.

From the command line:

# bzr checkout lp:play
# cd play/framework
# ant

The Play framework is ready to use.

lp:play currently aliases to http:bazaar.launchpad.net/%7Eplay-developers/play/1.0/

Using the play command

When the framework is correctly installed, open a shell and execute play.

$ play

You should see the play default message:

You can get more help on any specific command using play help any-command-name-here. For example, try:

# play help run

Creating a new application

Use the new command to create a new application. You must give a non-existent path where the application will be created.

# play new myApp

Will create a new application. Start it with:

# play run myApp

You can then open a browser at http://localhost:9000 and see the default page for the application.

Your play environnement is ready

See how to set up your preferred IDE.