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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With