Play Framework 2 Stage Task on Windows, "The input line is too long"

Ian picture Ian · Jan 29, 2014 · Viewed 9.1k times · Source

I'm trying to Play 2 application on Windows Server Server 2012 using the "stage" task, with the goal of wrapping this up in a service so the application will automatically run when the server gets restarted. However, when running the app I get the following message:

The input line is too long.
The syntax of the command is incorrect.

This is because Windows has a limit of around 8000 characters for command line instructions but it seems like the Play stage command is exceeding this by passing the classpath as an argument.

Copying the "stage" folder to c:\ might fix the issue (as it'll reduce the size of the classpath) but I was hoping there would be a more elegant solution.

Has anyone found a way around this? Alternatively, do people have any suggestions for running a Play application on Windows so that it will automatically run when the server is restarted.

Thanks.

Answer

NieMaszNic picture NieMaszNic · Mar 21, 2016

I also had the same issue and I wasn't satisfied with the solutions that you provided.

I have found a simpler solution.

Add the following line to the build.sbt file

lazy val root = (project in file(".")).enablePlugins(PlayScala, LauncherJarPlugin)

Now if you generate your production application with:

sbt dist

or run a production mode with

sbt start

The LauncherJarPlugin plugin will take care for generating proper bash/batch run scrips.

To get to know more about LauncherJarPlugin please read the documentation:

Sbt documentation about long classpath

How to enable plugin in build sbt