This Java tip illustrates a method of listing the contents of a ZIP file. Developer may use this as a functionality for its users to first see the contents of the ZIP file and then decompress the chosen one.

 try {
        // Open the ZIP file
        ZipFile sourcefile = new ZipFile("source.zip");
    
        // Enumerate each entry
        for (Enumeration entries = sourcefile.entries(); entries.hasMoreElements();) {
            // Get the entry name
            String zipEntryName = ((ZipEntry)entries.nextElement()).getName();
        }
    } catch (IOException e) {
    }