Skip to content

Create Play Java Project

Last Updated on 15/11/2020

This tutorial is going to show you how to create a Play Java project using the command line build tool SBT in simple steps.

Create a Workspace

First, create a workspace in order to keep things organised:

mkdir play-workspace
cd play-workspace

Create the Play Java project

Next, run the commands below to invoke the wizard for new projects:

sbt new playframework/play-java-seed.g8

After loading plugins and some processing, you will be prompted to type your project details. For starters, just set the name and the organization like the example below:

This template generates a Play Java project 

name [play-java-seed]: play-java-lab   
organization [com.example]: com.bgasparotto
scala_version [2.12.4]: 
play_version [2.6.12]: 
sbt_version [1.0.4]: 

Template applied in ./play-java-lab

Run your project

Go the folder created by the previous commands: cd play-java-lab

Launch your application with SBT:

sbt run

...
--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Enter to stop and go back to the console...)

Go to http://localhost:9000 and you should see the following:

Play Framework Welcome page

To stop the server, just hit Enter or Ctrl + C.

Hope it helps. Cya!

Leave a Reply

Your email address will not be published. Required fields are marked *