Monday, May 15, 2017

Play framework getting started with sbt

The earlier post introduces to Play, sbt and activator versions and the differences in the installation procedures.
This post describes the Play installation procedures with the sbt. The procedure is relevant for the sbt version 0.13.13 or higher.


Download and install:
1. Java 8 - download the relevant installation from Oracle site.
2. sbt - download from version.

Define/validate the environment variables:
1. Define the JAVA_HOME, for example:
C:\Program Files\Java\jdk1.8.0_45
2. Make sure the SBT_HOME is defined, for example:
C:\Program Files (x86)\sbt;  
Add path to both installed programs to the path variables:

Creating a new application

I never done this, so try to follow the instructions on the official site.

If it really works, that's it, a new application now may be started:
cd my-play-app
sbt run
After a while the server will start and the following prompt should appear on the console:
 [info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
The server by default is listening on port 9000. You can request it from a browser by the URL http://localhost:9000. You will get something like this:

Running on a different port

By default the sbt runs an application on port 9000 for http or 443 for https.
To run an application on the different port (http):
sbt"run 9005"

Going further

Import the project to eclipse with the post eclipse IDE setting
Convert the project to maven with the post creating of maven project

No comments :

About the author

My Photo
I trust only simple code and believe that code should be handsome. This is not a matter of technology, but professional approach, consolidated after years of software development. I enjoy to cause things working and feel very happy, when I manage to solve a problem.
Back to Top