Need to execute the below winzip command in a java program.
C:\Program Files\WinZip>winzip32 -a -s"password" C:\abc.zip C:\abc.doc
Need to execute the below winzip command in a java program.
C:\Program Files\WinZip>winzip32 -a -s"password" C:\abc.zip C:\abc.doc
Use Runtime#exec()
(tutorial here, caveats here) or just pure Java code (related SO topic).
By the way, if you didn't need password protection, you could just go ahead with java.util.zip
(tutorial here).
You can simple use Runtime.exec();
String[] cmd = {"C:\\Program Files\\WinZip\\winzip32", "-a", "-s", "password", "C:\\abc.zip", "C:\\abc.doc"};
Runtime.getRuntime().exec(cmd);
Taking a look around the internet, would this do what you're looking for: https://truezip.dev.java.net/ without having to rely on an external install of WinZip which may or may not exist on the end user system? Just a suggestion.