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 Git 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 distros). If you are using Windows, just download and install the latest JDK package.

Be sure to have Java in the current path (enter 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.5). 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 some reason, run ant in 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 Git client to fetch the sources and Ant to build the framework.

From the command line:

# git clone git://github.com/playframework/play.git
# cd play/framework
# ant

The Play framework is ready to use.

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

Next: Set-up your preferred IDE.