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
wrapper.java.app.mainclass = play.core.server.ProdServerStart

wrapper.java.classpath.1 = application_dir/dist/lib/*

wrapper.java = your_javadir/bin/java.exe
wrapper.java.command = your_javadir/bin/java
wrapper.java.additional.1 = -Dhttp.port=yourport
wrapper.java.additional.2 = -Dconfig.resource=prod.conf
wrapper.java.additional.3 = -Dlogger.resource=logger.prod.xml
wrapper.java.additional.4 = -Dpidfile.path=NUL
wrapper.java.additional.5 = -Xms80M
wrapper.java.additional.6 = -Xmx80m
wrapper.java.additional.7 = -server

wrapper.logfile=your_logdir/your_service.log

wrapper.console.title = Play App!
wrapper.ntservice.name = 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.

This website uses cookies. By continuing to browse the site you are agreeing to our privacy policy.By closing this banner or clicking on any other item of this page, you agree to the use of such cookies.