0

I want to change my directory and then execute a command to execute a testng class.

These is the command to change directory

cd D:\ACS\AndroidAutomationScripts\UiMutilator-master

This is the command to run testng class once i change dirctory

java -cp "D:\ACS\AndroidAutomationScripts\UiMutilator-master\lib\*;D:\ACS\AndroidAutomationScripts\UiMutilator-master\bin" org.testng.TestNG regression.xml

When I executed these commands from command prompt and from a bat file from java programmatically they are running fine.

But i want to execute these commands from java program only and in a particular directory.

I have tried creating multiple Process objects and tried executing it but it didnt worked.

Prasad Madge
  • 71
  • 1
  • 14
  • Not sure if I understood your question properly but you should try to add `/d` to your CD command. `cd /d D:\ACS\AndroidAutomationScripts\UiMutilator-master`. Just CD is not enough if you are on a different drive. – MichaelS Jul 18 '16 at 10:31
  • I want to execute 2 commands one to change directory and second to run my test class . This i want to do from java pro-grammatically using runtime or processbuilder classes. – Prasad Madge Jul 18 '16 at 11:00
  • This might help: http://stackoverflow.com/questions/6811522/changing-the-working-directory-of-command-from-java – MichaelS Jul 18 '16 at 12:38

0 Answers0