1

I created a Windows batch file to start my Play Framework application as detailed here: play framework bat windows java process

java %1 -cp "./lib/*;" play.core.server.NettyServer .

This works, but when I try and add a command-line flag to specify a production configuration file I get a 'Not a Play application' error message:

java %1 -Dconfig.file=application-prod.conf -cp "./lib/*;" play.core.server.NettyServer .

My two questions are:

  1. What does the '%1' and '.' represent to the java launcher?
  2. How can I pass the '-D' command-line flags to the Play application in a Windows batch file?
Community
  • 1
  • 1
disperse
  • 1,216
  • 10
  • 22
  • the %1 is the first argument the batch-file is called with, four instance if the batch-file is called with `something.bat test` then `%1` will be `test` – Dennis van Gils May 31 '16 at 19:53
  • Why does the accepted answer here http://stackoverflow.com/questions/10894615/play-framework-bat-windows-java-process have a '%1' with no information about what arguments are passed to start.bat. – disperse May 31 '16 at 20:25
  • does it get called from another program, or does it always need to be called manually? – Dennis van Gils May 31 '16 at 20:30
  • We're calling it manually, sounds like it's safe to leave the '%1' off then, just need to figure out how to make the '-D' flags work. – disperse May 31 '16 at 20:34
  • I wouldn't leave out the %1, I'm guessing (because of it's position) that that's probably the location of the java file that needs to be executed, although I could be wrong. – Dennis van Gils Jun 01 '16 at 07:54

1 Answers1

2

Through trial and error we arrived at the following solution:

java -cp "./lib/*" -Dconfig.file=application-prod.conf play.core.server.NettyServer

Hope this helps someone in the future!

disperse
  • 1,216
  • 10
  • 22