package com.example;
import com.aspose.zip.ZArchive;

public class main
{
    public static void main(String[] args)
    {
        // Set path for the working directory.
        String dataDir = "/Desktop/";
        // Create an instance of the ZArchive class. 
        try (ZArchive archive = new ZArchive()) {
            // Invoke the setSource method to set the content to be compressed within the archive.  
            archive.setSource(dataDir + "first.txt");
            // Call the save method to save Z archive to destination file provided. 
            archive.save(dataDir + "archive.z");
        }
        System.out.println("Successfully Compressed a File");
    }
}