Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activator : Play Framework 2.3.x : run vs. start

Tags:

scala

Why do these two commands behave differently?

Starting Play in production mode and starting dev mode differs?

activator run -Dconfig.file=/myConfig.conf # works
activator "run -Dconfig.file=/myConfig.conf" # works

activator "start -Dconfig.file=/myConfig.conf" # Works
activator start -Dconfig.file=/myConfig.conf # Doesn't, config file not found
like image 561
Andreas Neumann Avatar asked Oct 27 '14 13:10

Andreas Neumann


1 Answers

The fundamental difference between the two commands is what is tripping you up here. The activator starts a JVM and then executes the command you've given on the command line. The difference between run and start is the introduction of another JVM. The start command starts your program in a new JVM while run does not. So, for your four cases:

activator run -Dconfig.file=/myConfig.conf # works

The -D argument is going to activator's JVM which then executes run. It works because run is using the same JVM as the activator.

activator "run -Dconfig.file=/myConfig.conf" # works

The activator's JVM gets no -D argument but it interprets "run -Dconfig.file=/myConfig.conf" and sets the config.file property accordingly, also in the activator's JVM.

activator "start -Dconfig.file=/myConfig.conf" # Works

The activator starts a new JVM and passes the -D option to it as well as starting your program, so it works because your program gets the config.file property.

activator start -Dconfig.file=/myConfig.conf # Doesn't work, config file not found

The activator's JVM receives the -D option and then executes start command by creating a new JVM which does not get a -D option so it fails.

like image 84
Reid Spencer Avatar answered Nov 08 '22 17:11

Reid Spencer