Play Framework 2 on Windows Server as service

2 min read
Deploy a Play Framework 2 application on Windows Server is not very simple, i'll show our solution.

First step is to build a standalone version of your app with "play dist" command from Play console, you have now a .zip file in your application_dir/dist/ directory, extract the zip in a server folder. Remove the sans-externalized application jar and add the taget/scala-2.xx/appname_2.xx.jar .

The second step is to download YAJSW and extract in the server in yajswdir/ folder and create a .conf  file like:

wrapper.working.dir = application_dir
wrapper.startup.timeout = 60 = play.core.server.ProdServerStart = application_dir/dist/lib/* = your_javadir/bin/java.exe = your_javadir/bin/java = -Dhttp.port=yourport = -Dconfig.resource=prod.conf = = -Dpidfile.path=NUL = -Xms80M = -Xmx80m = -server


wrapper.console.title = Play App! = Play App!
wrapper.ntservice.displayname = Play App!
wrapper.ntservice.description = Play App!

The third and last step is to open a terminal, go to the yajswdir directory and run the command:

[code gutter="false"]java -jar wrapper.jar -i conf/yourconf.conf[/code]

Now you can find the service "Play App!" in your services list.