Launhing appium node.js server using java and JUnit/TestNg

Hi

Me very new to Appium , every thing going well but i have a problem … below is my code to start appium node server
@Test
public void sample test { }

@BeforeClass
public static void StartServer() throws ExecuteException,
IOException {
CommandLine command = new CommandLine(“cmd”);
command.addArgument("/c");
command.addArgument(“C:/Program Files (x86)/nodejs/node.exe”);
command.addArgument(“C:/Users/rkesireddy/Downloads/AppiumForWindows-1.2.4.1/Appium/node_modules/appium/bin/appium.js”);
command.addArgument("–address");
command.addArgument(“127.0.0.1”);
command.addArgument("–port", false);
command.addArgument("" + portNumber + “”);
command.addArgument("–no-reset");
command.addArgument("–log");
command.addArgument(“C:\Users\rkesireddy\Desktop\log.txt”);
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);
executor.execute(command, resultHandler);
}

when i execute this code using JUnit the code is not doing any thing and slowing debugged by opening task manager in details section i can see node.js is opening and disappears with in sec , actually it open and closed

But when run with java application
public static void main(String Args[]) throws ExecuteException, IOException {
Same code as above in @BeforeClass
}

It work i can see logs on console and log file
Welcome to Appium v1.2.4 (REV 71584425ecf777349e3215f0f18e71e7782acfb6)
Appium REST http interface listener started on 127.0.0.1:4895

can any body help to solve this
thanks in advance

Rakesh Kesireddy