How to launch android emulator via java program?


Could some one share java code to launch android emulator device? Right now I am launching every time through command prompt: emulator.exe -avd SampleEmulator.

Actually I want to automate complete flow i.e start Appium server, and then start emulator device and then execute tests.


Did you find a way to do this?