Documentation

You are viewing the documentation for the 2.7.1 release in the 2.7.x series of releases. The latest stable release series is 3.0.x.

§Creating a new application

To learn about Play hands-on, try the examples as described below, they contain everything you need to build and run them. If you have sbt installed, you can create a Play project with a single command, using our giter8 Java or Scala template. The templates set up the project structure and dev environment for you. You can also easily integrate Play projects into your favorite IDE.

§Downloading and building examples

Lightbend Tech Hub offers a variety of Play examples for Java and Scala. We recommend trying the Hello World tutorial for Java or Scala first:

  1. Play Java Starter Example
  2. Play Scala Starter Example

The downloadable zip files include everything you need to build and run the examples, including a distribution of the sbt and Gradle. Check out the README.md file in the top level project directory to learn more about the example.

§Using a project template

If you already have sbt installed, you can use a giter8 template, similar to a Maven archetype, to create a new Play project. This gives you the advantage of setting up your project folders, build structure, and development environment - all with one command.

In a command window, enter one of the following lines to create a new project:

§Java template

sbt new playframework/play-java-seed.g8

§Scala template

sbt new playframework/play-scala-seed.g8

After the template creates the project:

  1. Enter sbt run to download dependencies and start the system.
  2. In a browser, enter http://localhost:9000/ to view the welcome page.

§Play Example Projects

Play has many features, so rather than pack them all into one project, we’ve organized many example projects that showcase a feature or use case of Play so that you can see Play at work.

Note: the example projects are not configured for out of the box security, and are intended to showcase particular areas of Play functionality.

See Lightbend Tech Hub to get more details about how to use the download and use the example projects.

Next: Anatomy of a Play application