Starting Appium in Java Programmitacally

Hi,

I would like to launch Appium programitacally in Java, where the script is in the main function of the jar file.
I am kinda new to this, anyone with any suggestions? I’m using IntelliJ on a Windows machine.

@czynjay

You may start Appium Server side where the code is been executed.

This is the Java code:

private static AppiumDriverLocalService appiumServer;

    public static void startAppiumServer(int port) {
        if (appiumServer == null) {
            appiumServer = AppiumDriverLocalService.buildService(
                    new AppiumServiceBuilder()
                            .usingPort(port));
        }
        appiumServer.start();
    }

This code is only for Windows.

You may check this link for options.

BR