zip folder in windows using command line

alisrky

New Member
I am writing a program that needs to zip a file.This will run over both linux and windows machines. It works just fine in Linux but I am not able to get anything done in windows. To send commands I am using the apache-net project. I've also tried using Runtime().execbut it isn't working. Can somebody suggest something?\[code\]CommandLine cmdLine = new CommandLine("zip"); cmdLine.addArgument("-r"); cmdLine.addArgument("documents.zip"); cmdLine.addArgument("documents"); DefaultExecutor exec = new DefaultExecutor(); ExecuteWatchdog dog = new ExecuteWatchdog(60*1000); exec.setWorkingDirectory(new File(".")); exec.setWatchdog(dog); int check =-1; try { check = exec.execute(cmdLine); } catch (ExecuteException e) { } catch (IOException e) { }\[/code\]
 
Top