Solved

Extracting a Rar file

Posted on 2009-07-13
13
1,482 Views
Last Modified: 2012-05-07
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
Comment
Question by:iphone
  • 5
  • 4
  • 3
  • +1
13 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
Comment Utility
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
Comment Utility
0
 
LVL 7

Expert Comment

by:Seo_Expert
Comment Utility
Hello,

You can check below url :

http://forums.sun.com/thread.jspa?threadID=5397113
0
 

Author Comment

by:iphone
Comment Utility
thanks for your guys fast response
let me check it out first 1 by 1


0
 

Author Comment

by:iphone
Comment Utility
@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
 
LVL 92

Expert Comment

by:objects
Comment Utility
sure, I'll post an example of it usage shortly.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 92

Expert Comment

by:objects
Comment Utility
               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
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>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
 
LVL 92

Expert Comment

by:objects
Comment Utility
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
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>easier to just make a Runtime.exec() call

To what?
0
 

Author Comment

by:iphone
Comment Utility
@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
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
:-)
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
(-: another satisifed customer, you know where to find me if you need further help
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now