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 Adoptium.
To try the tutorial, first download the Java or Scala project:
Play 2.8.x Hello World Projects | |
---|---|
Play Java Hello World Tutorial | View on GitHub |
Play Scala Hello World Tutorial | View on GitHub |
To run the tutorial:
- Unzip the project in a convenient location.
- In a command window, change to the top-level project directory.
- Enter
sbt run
. - After the message
Server started, ...
displays, enter the following URL in a browser: http://localhost:9000
The tutorial welcome page displays.
Already know a bit about Play?
Lightbend offers a variety of Play example projects for Java and Scala that are focused on a particular use case. These 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.
» 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:
- Change into the top level project directory.
- Enter
sbt run
to download dependencies and start the system. - In a browser, enter http://localhost:9000 to view the welcome page.