In this post, I will show you how to unzip a .zip-file in java.
First, add the Maven dependency:
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-compress</artifactId>
<version>1.4</version>
</dependency>
Then, you need to add the following code to your method where you want to unzip.
Unzip unzipper = new Unzip();
try {
unzipper.setSrc(new File("test.zip"));
unzipper.setDest("/myFolderToExtract");
unzipper.execute();
} catch (IOException e) {
e.printStackTrace();
}