I need to execute multiple comments in single cmd window using java.
The comments are
1. cd C:\Apps\wildfly-8.0.0.Final\bin
2. jboss-cli.bat --connect --command=\"deploy --force C:\Users\me\git\test\Test\build\libs\TestEAR.ear
Because I need to execute the second command from the folder "C:\Apps\wildfly-8.0.0.Final\bin".
I tried this :
Runtime.getRuntime().exec("cmd /c start cd C:\\Apps\\wildfly-8.0.0.Final\\bin\\ && start cmd.exe /c jboss-cli.bat --connect --command=\"deploy --force C:\\Users\\me\\git\\test\\Test\\build\\libs\\TestEAR.ear\"");
But it is executing these commands separate , that is it will open one cmd window and executes the first commands , then it will execute the second command in another cmd window , and showing the error :
Could not locate "C:\Users\me\git\test\Test\build\libs\TestEAR.ear".
Please check that you are in the bin directory when running this script.
Press any key to continue . . .
I found some solutions with batch file , but in my application I can't use batch file (must not use batch file ) .
Can anyone suggest a solution ?