• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

java API to extract ZIP, RAR and TAR files

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any java API to extract ZIP, RAR and TAR files ?
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22849
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic