Getting Started with Play Framework

New to Play?

» Learn whether Play Framework is right for your project

» Try a Hello World Tutorial

The Play Java and Play Scala "Hello World" projects are self-contained tutorials that are part of the play-samples repository. To try a tutorial, you can either clone the repository and check out the respective branch or download its contents as a zip file:

Play 3.0.x Hello World Projects (Built on Pekko)

Play Java Hello World View on GitHub Download zip then unzip and
cd ./play-java-hello-world-tutorial/
Play Scala Hello World View on GitHub Download zip then unzip and
cd ./play-scala-hello-world-tutorial/

Play 2.9.x Hello World Projects (Built on Akka)

Play Java Hello World View on GitHub Download zip then unzip and
cd ./play-java-hello-world-tutorial/
Play Scala Hello World View on GitHub Download zip then unzip and
cd ./play-scala-hello-world-tutorial/

Besides replacing Akka with Pekko, Play 3.0 is identical to Play 2.9. If you don't know what Akka or Pekko is, we recommend using Play 3.0. For more details on which version to use, read "How Play Deals with Akka’s License Change".

To run a tutorial follow the README file instructions in the respective folder. In short:

  1. Please check the requirements for using Play: Java and sbt needs to be installed.
  2. Clone or unzip the repo in a convenient location.
  3. In a command window, change to the project directory of the desired tutorial.
  4. Enter sbt run.
  5. After the message Server started, ... displays, enter the following URL in a browser: http://localhost:9000
  6. The tutorial welcome page displays.

Already know a bit about Play?

There are a variety of Play example projects for Java and Scala that focus on specific use cases. To run these sample projects, please check the requirements for using Play: Java and sbt needs to be installed.

If you are ready to start your own project and have sbt and Java installed, you can create a Play project from the command line.

» Create a new Play Java or Scala project using sbt new

In a command window, enter the following:

sbt new

In the interactive menu choose:

  • playframework/play-scala-seed.g8 for a Play Scala project
  • playframework/play-java-seed.g8 for a Play Java project

Then respond to the prompts. After the project got created:

  1. Change into the top level project directory.
  2. Enter sbt run to download dependencies and start the system.
  3. In a browser, enter http://localhost:9000 to view the welcome page.

Using the Java seed template directly instead

Enter:

sbt new playframework/play-java-seed.g8
To create a Play Java 2.9 project:
sbt new playframework/play-java-seed.g8 --branch 2.9.x

Using the Scala seed template directly instead

Enter:

sbt new playframework/play-scala-seed.g8
To create a Play Scala 2.9 project:
sbt new playframework/play-scala-seed.g8 --branch 2.9.x

Besides replacing Akka with Pekko, Play 3.0 is identical to Play 2.9. If you don't know what Akka or Pekko is, we recommend using Play 3.0. For more details on which version to use, read "How Play Deals with Akka’s License Change".