apache - How to give response to command line using java -
apache - How to give response to command line using java -
i executing command using java code. 1 time command start running asking user input. dont know how provide input using java code. please help me.
i using apache org.apache.commons.exec.commandline bundle run command.
output after running command using java code :
[java] ear file archive to: 17 mb in size. [java] sure want build it? [y]ear building cancelled user
java code :
try { commandline cmdline = new commandline(command); (int = 0; < args.size(); i++) { cmdline.addargument(args.get(i)); } defaultexecutor exec = new defaultexecutor(); exec.setworkingdirectory(new file(dir)); if (timeout > 0) { executewatchdog watchdog = new executewatchdog(timeout); exec.setwatchdog(watchdog); } exitvalue = exec.execute(cmdline); homecoming exitvalue; } grab (exception e) { log.error(e, e); }
use system.in in java accepting input values
java apache command-line command command-line-arguments
Comments
Post a Comment