• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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: 22781
131
Eclipse IDE Spring VI Editor 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.
 
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic