Passings arguments to a batch file while executing from Java.
I want to pass a argument to a batch file using Runtime.exec() method.
I am using below code to execute batch file:
Runtime r = Runtime.getRuntime();
Process proc = null;
proc = r.exec("create.bat", null, new File("C:\\apache-james-3.0-beta4\\bin"));
I placed "create.bat" under "C:\\apache-james-3.0-beta4\\bin".
In "create.bat" I have:
james-cli -h localhost -p 9999 adduser %1 Welcome123!
Please help me to pass argument using above.
Re: Passings arguments to a batch file while executing from Java.
What happens when the code is executed? Add code to read and display the streams returned by the Process returned by the exec() method so you see any messages.