I have a little problem with running the command line tool. I want to execute UnRAR.exe from WinRAR. I do it like this:
Process process = runtime.exec("\"" + unrarPath + "\"" + " x -kb -vp " + "\"" + fileName + "\"", null, f.getParentFile());
My problem is that the compressed file is password protected. If I execute the command in the console, I will be asked to enter a password. If I let Java execute it, the program simply ends and never waits for user input (password).
I tried to write to the process output, but it did not work. Is there anything I need to know about the behavior of command-line programs running in "different" environments?
EDIT: Perhaps I was not clear enough. My question is: is it possible to interact with the command line program with Java?
source
share