By   March 6, 2016

Play framework with Scala – Getting Started

Play is a web framework based on JVM languages including Scala and Java. This post is about getting you up running a basic Hello world application with Scala using IntelliJ IDEA.

Download IntelliJ IDEA

IntelliJ IDEA can be downloaded from JetBrains. Here is the download link:

IntelliJ IDEA download

IntelliJ IDEA download

Downloading Activator

There are many example projects and templates available for scala. The same is true for Play framework. There are myriads of demos available for checking out how a particular feature needs to be implemented. They also enable us to seed a project saving the setup time.

There are activators available from different providers including Lightbend. These activators allow us to download these templates and demos. Let’s download an activator from LightBend to seed our play project.

Lightbend Activator Download

Lightbend Activator Download

or we can download these templates directly.

Lightbend Templates

Light Bend Templates

There are three tasks you can do with activator. They are as follows:

  • Running activator UI (./activator ui)
  • Listing available templates (./activator list-templates)
  • Creating new project based on a particular template (./activator new {TEMPLATE_NAME})

If you want to go to the activator route, then you can look for templates using list-templates switch. And then you can create a new project based on the template of your choice using new switch.

This creates a project in the selected folder.

Lightbend New Project

Lightbend New Project

We can open this in the IntelliJ IDE downloaded earlier. Here are the contents of the folder for created project.

Lightbend new project details

Lightbend New Project Details

As you can notice there are files more than the project files themselves. Please note the activator. This allows us to build and run play from the terminal easily. Here we are using activator to run our play project. This would use the default netty server to host the project.

Screen Shot 2016-03-06 at 2.13.56 PM

And here is how the default page for the project.

Activator running play

Activator running play