Launching Appium programatically on Mac fails to create DesiredCapabilities variable

I’m testing an ios app on real device (version 10.2) using Appium (version 1.6.3).
Up until now I used to launch appium from Terminal and run my java code separately. Recently, I started launching appium from my code, and the appium server runs with no visible problems.
but when i try to run my test, it finishes all running process when arriving to the DesiredCapabilities part. I’m creating a new thread to run the tests so the server can run in main thread. when the code arrives to this point: DesiredCapabilities capabilities = new DesiredCapabilities(); it stopes running all code (doesn’t even throw an exception).
please help…

Facing the same issue.

Please share any solution, if possible