![]() ![]() ![]() ![]() I have an Keyborad class that encloses the Robot, to simplify the proces of typing. You can use a java Robot class to do that. In order to be able to enter this password, you need to start a console window, and then mimic the behavior of keyboard, so it will be like someone is really typing into the window. I belive this is the case when you enter password for 7z using command line. You can't type to some command line programs using std.out, because they don't read std.out, they just read signs entered on keyboard. ProcessBuilder pb = new ProcessBuilder("7z", "e", "bootstrap.7z", "-so", "bootstrap.txt") īufferedWriter writer = new BufferedWriter(new OutputStreamWriter(p.getOutputStream())) īufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())) Īlthough I have passed the password via BufferedWriter, I still need to input the password manually when I run the java program.įor the security reason, I can't use the parameter "-p" to pass the password to the 7z when create the sub-process(If the process "7z" hang, the customer can see the password from the process information via the command "ps aux | grep 7z").Ĭan you pls figure out the issue in my code? My java version is 1.8, the OS is Ubuntu 16.04. In my project, we need to extract a file from a password protected 7zip archive. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |