It looks like the answer to your problem was answered here: how to zip a folder itself using java
There it is explained how to zip a file/folder using Java.
You have to save the files in the folder for this to work, but once it is zipped, you can delete the original folder following this tutorial which uses:
String path = "/path/to/file";
Files.delete(path);
This way the only thing saved will be the zip file.