Sonson123 Sonson123 - 3 months ago 18
Java Question

Playframework app including a standalone main application

I am writing a webapp with Playframework 2.2 in Java.
Now I want to add a small standalone text-to-database-import tool, which consists of only one Java file with a


public static void main(String[] args) {

  • Can I include this standalone mini-app together with the rest of the webapp?

  • How can I then run it in the
    ) (without the webapp)?

  • Or is it better to create a second project for this app?


Figured this out a few months ago and forgot. Just took me two hours to figure it out again. The answer is run-main. The trick is you need quotes around run-main and the parameters that follow it or it will give you an error. So...

If you have a class my.package.Main your would run it with:

play "run-main my.package.Main"

I believe you can also run it directly from sbt with a similar command:

sbt "run-main my.package.Main"