Triggering Appium from the command line via Java code

It’s not optimal, but you could put a Thread.sleep(int milliseconds) right after your command execution to give the server enough time to start.

A better answer may be found in this topic : Launching and stopping appium server programmtically