I am trying to implement program to zip and unzip a file. All I want to do is to zip a file (fileName.fileExtension) with name as fileName.zip
Try with:
File file = new File("fileName.zip"); // handler to your ZIP file File file2 = new File("fileName.fileExtension"); // destination dir of your file boolean success = file.renameTo(file2); if (success) { // File has been renamed }