public void start ( ) throws AppiumServerHasNotBeenStartedLocallyException { lock . lock ( ) ; try { if ( isRunning ( ) ) { return ; } try { process = new CommandLine ( this . nodeJSExec . getCanonicalPath ( ) , nodeJSArgs . toArray ( new String [ ] { } ) ) ; process . setEnvironmentVariables ( nodeJSEnvironment ) ; process . copyOutputTo ( stream ) ; process . executeAsync ( ) ; ping ( startupTimeout , timeUnit ) ; } catch ( Throwable e ) { destroyProcess ( ) ; String msgTxt = "The local appium server has not been started. " + "The given Node.js executable: " + this . nodeJSExec . getAbsolutePath ( ) + " Arguments: " + nodeJSArgs . toString ( ) + " " + "\n" ; if ( process != null ) { String processStream = process . getStdOut ( ) ; if ( ! StringUtils . isBlank ( processStream ) ) { msgTxt = msgTxt + "Process output: " + processStream + "\n" ; } } throw new AppiumServerHasNotBeenStartedLocallyException ( msgTxt , e ) ; } } finally { lock . unlock ( ) ; } }
Starts the defined appium server .