Who starts the prerequisite applications?

I have two Applications I will call A1 and A2. A1 needs A2 to be already running, so I put A2 in the ‘applications’ list in a1.app.src. But then if I do application:start(a1) I will get the error message {error,{not_started,a2}}. It never gets as far as code I put in a1_app.erl to actually start A2. So who starts a2? Will OTP do it for me or does there have to be a higher level app whose supervisor code starts A2 and then runs A1? Or start them all in order from the ‘erl’ command line?

Either you or some other previous application starts A2, or you use application:ensure_all_started/2.


If you build a release a boot script is created which handles starting the dependencies.

1 Like