extract a zip file: java or script?
I开发者_StackOverflow need to write a java class that extracts a content of zip file into a server folder. What is the best way to do it? Do you recommend using ZipFile class, or invoking a script that unzips and copies content?
I feel like using scripts (ant/maven) is more natural for this task, whereas Java needs to work hard to read all the files & folders to heap and write them to another folder.
(I need it for installer task)
thanks
Use ZipFile class. What language have you used to write the script?
I feel like using scripts (ant/maven) is more natural for this task, whereas Java needs to work hard to read all the files & folders to heap and write them to another folder.
Using a separate application (e.g. Ant / Maven / an "unzip" utility) is less coding work. However, it also requires that the application is available on the platform on which you want your installer to run. Also, Ant and Maven will typically require you to create a "build.xml" or "pom.xml" file to tell the application what to do.
Ant is possibly a good option from this respect because you can embed the relevant Ant JAR file in your installer, and the "build.xml" file can be really simple.
But it all boils down to which approach you think will be easiest to implement ... given all of your requirements.
精彩评论