node/server.js
function startServlet(cb) {
    startingServer = true;
    servletReady = false;
        debugger;
    findPort(function(port) {
        servletPort = global._servletPort = '' + port;

        servlet = global._servlet = cp.spawn('java', ['-cp', '.:../lib/servlet-api-2.5.jar:../lib/jetty-all-7.0.2.v20100331.jar', 'RunnerServlet', servletPort], {
            cwd: config.rootDir + '/bin'
        });
        servlet.stdout.on('data', function(data) {
            console.log('OUT:' + data);
        });
        servlet.stderr.on('data', function(data) {
            console.log("" + data);
            if (~data.toString().indexOf(servletPort)) {
                servletReady = true;
                startingServer = false;
                // queue.checkQueues();
                observer.emit("server.running", port);
                if (cb) cb(port);
            }
        });

        
        servlet.on('exit', function(code, signal) {
            resetFlags();
            if (code === null || signal === null) {
                serverExit = true;
            }
            log('servlet exist with code ' + code + 'signal ' + signal);
            observer.emit('server.exit',code);
        });
        // make sure to close server after node process ends
        process.on('exit', function() {
            stopServer(true);
        });
    });
}
function startServlet(cb) {
    startingServer = true;
    servletReady = false;
        debugger;
    findPort(function(port) {
        servletPort = global._servletPort = '' + port;

        servlet = global._servlet = cp.spawn('java', ['-cp', '.:../lib/servlet-api-2.5.jar:../lib/jetty-all-7.0.2.v20100331.jar', 'RunnerServlet', servletPort], {
            cwd: config.rootDir + '/bin'
        });
        servlet.stdout.on('data', function(data) {
            console.log('OUT:' + data);
        });
        servlet.stderr.on('data', function(data) {
            console.log("" + data);
            if (~data.toString().indexOf(servletPort)) {
                servletReady = true;
                startingServer = false;
                // queue.checkQueues();
                observer.emit("server.running", port);
                if (cb) cb(port);
            }
        });

        
        servlet.on('exit', function(code, signal) {
            resetFlags();
            if (code === null || signal === null) {
                serverExit = true;
            }
            log('servlet exist with code ' + code + 'signal ' + signal);
            observer.emit('server.exit',code);
        });
        // make sure to close server after node process ends
        process.on('exit', function() {
            stopServer(true);
        });
    });
}
function startServlet ( cb ) { startingServer = true ; servletReady = false ; debugger ; findPort ( function ( port ) { servletPort = global . _servletPort = '' + port ; servlet = global . _servlet = cp . spawn ( 'java' , [ '-cp' , '.:../lib/servlet-api-2.5.jar:../lib/jetty-all-7.0.2.v20100331.jar' , 'RunnerServlet' , servletPort ] , { cwd : config . rootDir + '/bin' } ) ; servlet . stdout . on ( 'data' , function ( data ) { console . log ( 'OUT:' + data ) ; } ) ; servlet . stderr . on ( 'data' , function ( data ) { console . log ( "" + data ) ; if ( ~ data . toString ( ) . indexOf ( servletPort ) ) { servletReady = true ; startingServer = false ; // queue.checkQueues(); observer . emit ( "server.running" , port ) ; if ( cb ) cb ( port ) ; } } ) ; servlet . on ( 'exit' , function ( code , signal ) { resetFlags ( ) ; if ( code === null || signal === null ) { serverExit = true ; } log ( 'servlet exist with code ' + code + 'signal ' + signal ) ; observer . emit ( 'server.exit' , code ) ; } ) ; // make sure to close server after node process ends process . on ( 'exit' , function ( ) { stopServer ( true ) ; } ) ; } ) ; }
Starts the servlet on an empty port default is 3678
Starts the servlet on an empty port default is 3678