Getting Started with Play Framework

New to Play?

» Learn whether Play Framework is right for your project

» Try the Hello World Tutorial

The Java and Scala Hello World projects are self-contained tutorials that include a distribution of the sbt build tool.

Play requires Java 8 or higher. Check your version with the java -version command and if needed, install it from Oracle's site.

To try the tutorial, first download the Java or Scala project:

Play 2.6.x Hello World Projects

Play Java Hello World Tutorial Download (zip) View on GitHub
Play Scala Hello World Tutorial Download (zip) View on GitHub

To run the tutorial:

  1. Unzip the project in a convenient location.
  2. In a command window, change to the top-level project directory.
  3. Enter sbt run.
  4. After the message Server started, ... displays, enter the following URL in a browser:

    The tutorial welcome page displays.

Already know a bit about Play?

Lightbend Tech Hub offers a variety of Play example projects for Java and Scala that are focused on a particular use case. The downloadable zip files include everything you need, including sbt, Play Framework, and an HTTP server. The examples also support Gradle.

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

» Try a focused example

Follow these steps to try an example project:

  1. Check that your Java version is 8 or higher with the java -version command and if needed, install it from Oracle's site.
  2. Choose an example from Lightbend's Tech Hub.
  3. Click "CREATE A PROJECT FOR ME" to download the zipped project.
  4. Unzip the project in a convenient location.
  5. In a command window, navigate to the top level project directory.
  6. Enter one of the following commands:
    • On macOS or Linux systems: ./sbt run or ./gradlew runPlayBinary
    • On Windows systems: sbt.bat run or gradlew.bat runPlayBinary
  7. The build tool downloads dependencies and compiles the project.
  8. After the build finishes, enter the following URL in a browser to view the app: http://localhost:9000/

Check out the README.md file in the top level project directory to learn more about the example.

» Create a Play Java or Scala project using sbt new

In a command window, enter one of the following and respond to the prompts to create a new project:

Java seed template

sbt new playframework/play-java-seed.g8

Scala seed template

sbt new playframework/play-scala-seed.g8

After the template creates the project:

  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.