• Post Reply Bookmark Topic Watch Topic
  • New Topic

java API to extract ZIP, RAR and TAR files  RSS feed

 
laks ashok
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any java API to extract ZIP, RAR and TAR files ?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by laks ashok:
Is there any java API to extract ZIP, RAR and TAR files ?


What do you exactly mean by extract? From the command line? If yes, take a look at the "jar" command. Through your application? Take a look at the ZipInputStream.
 
laks ashok
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to write a core java batch process to extract the contents from an archived file ( zip / rar and tar )

For Zip, I can use java.util.zip.

For RAR I found a pretty old version of Junrar
For TAR soemthing called javaTAR

I was wondering if there is a different option to achieve this.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used Apache Commons Compress for TAR. It also has (according to its documentation) a better ZIP than java.util.zip, and BZIP2.
 
laks ashok
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For RAR2 formats I used unrar.jar.

Looks like there is no library available for unrar'ing RAR3 format.

If available, and I could use them through JNI , please do suggest.
 
Rob Spoor
Sheriff
Posts: 21048
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with RAR is that it's a closed format, so any library either needs to get a license or reverse engineer the format. The latter is (most likely) illegal so that's why there are so few libraries available.

As for using JNI, that would require a 3rd party library of which you can call functions to un-rar files. I doubt there is one though, as it has the same problems as Java libraries.

Perhaps you can use Runtime.exec or ProcessBuilder? In which case I suggest reading this article.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!