File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes extract .rar file with java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "extract .rar file with java" Watch "extract .rar file with java" New topic
Author

extract .rar file with java

Eideo Guo
Greenhorn

Joined: Aug 16, 2005
Posts: 29
HI all,
How do i extract .rar file(Not .zip file) with java?Were there open source?
thanks in advance
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3169
    
  10
According to this a rar file is just a jar file with a different extension. The Java API has classes for handling jar files.


Joanne
Eideo Guo
Greenhorn

Joined: Aug 16, 2005
Posts: 29
Thank you,but i use java api to reading rar file(winrar compress), it throws

my code as follow:
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3169
    
  10
Are you sure the file is a RAR file ? Try opening it using a zip utility.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

Joanne, there are two different things called RAR.

What you are referring to are J2EE Resource Archives. These are indeed just JAR files with the extension RAR (just like you have WAR and EAR files in J2EE).

But there's also an archive format called RAR, which is an alternative to ZIP files. Such RAR files are something entirely different than J2EE RAR files. I guess that Eideo means this with RAR files. See http://www.rarlab.com

Sorry Eideo, I don't know of any Java API for RAR files. Have a look at http://www.wotsit.org which does have a link to a document that describes the RAR file format. I have no idea if there are official public specifications on the RAR format or if it's a proprietary format.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Eideo Guo
Greenhorn

Joined: Aug 16, 2005
Posts: 29
Yes,as Jesper said,i said the RAR files were different from J2EE RAR files.
Romi Doshi
Greenhorn

Joined: Aug 23, 2005
Posts: 2
Has anyone found a solution to this question? If so, please email me... thanks
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8710
    
    6

Just taking a stab at this, but how about:

unrar can be found here


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Hinse ter Schuur
Greenhorn

Joined: Aug 21, 2003
Posts: 1
Maybe this project will do the trick:
http://sourceforge.net/projects/java-unrar/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: extract .rar file with java
 
Similar Threads
Downloading Solaris OS
RAR
Problems installing Tomcat6 Service
java API to extract ZIP, RAR and TAR files
Uncompress RAR file using JAVA