Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1872
  • Last Modified:

Extracting a Rar file

the idea is simple
i need to unrar/extract a .rar file

is  java can to do this? all i got i unzip a file, but i need to unrar
or is there any java library(free) for this extracting a rar file?

any link or tips will much appreciate

Thanks
0
iphone
Asked:
iphone
  • 5
  • 4
  • 3
  • +1
2 Solutions
 
objectsCommented:
0
 
Seo_ExpertCommented:
Hello,

You can check below url :

http://forums.sun.com/thread.jspa?threadID=5397113
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
iphoneAuthor Commented:
thanks for your guys fast response
let me check it out first 1 by 1


0
 
iphoneAuthor Commented:
@CEHJ
i have donwload chilkat and give it a try
but when i try to rum chilkat example from the link u gave me
it catching an exception in the first hand that the library failed to load
though i add the chilkat.jar into my libraries..
did i miss something?

@Object & seo_expert
i've been trying to search the API and sample code to unrar a file
i just cant found them..u have a simple sample to unrar the file using this Junrar

Thanks
0
 
objectsCommented:
sure, I'll post an example of it usage shortly.
0
 
objectsCommented:
               File f = new File(filename);
                Archive a = new Archive(f);
                a.getMainHeader().print();
                FileHeader fh = a.nextFileHeader();
                while(fh!=null){        
                        File out = new File(fh.getFileNameString().trim());
                        System.out.println(out.getAbsolutePath());
                        FileOutputStream os = new FileOutputStream(out);
                        a.extractFile(fh, os);
                        os.close();
                        fh=a.nextFileHeader();
                }
0
 
CEHJCommented:
>>it catching an exception in the first hand that the library failed to load

You'll need to put the dll into java.library.path. You could just do


copy x.dll %WINDIR%

as an admin
0
 
objectsCommented:
easier to just make a Runtime.exec() call :)   Always avoid native libs where possible makes your life as a java developer a lot simpler
0
 
CEHJCommented:
>>easier to just make a Runtime.exec() call

To what?
0
 
iphoneAuthor Commented:
@object
i need aother library(common logging)
unless its return me an blocksize error.
anywaysThanks, your code works

@cehj
oh no wonder...i copy already and its work also

Thanks guys for yours response

0
 
CEHJCommented:
:-)
0
 
objectsCommented:
(-: another satisifed customer, you know where to find me if you need further help
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 5
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now