Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Extracting a Rar file

Posted on 2009-07-13
13
Medium Priority
?
1,812 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
  • +1
13 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 1000 total points
ID: 24837721
0
 
LVL 92

Assisted Solution

by:objects
objects earned 1000 total points
ID: 24837725
0
 
LVL 7

Expert Comment

by:Seo_Expert
ID: 24837726
Hello,

You can check below url :

http://forums.sun.com/thread.jspa?threadID=5397113
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 

Author Comment

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


0
 

Author Comment

by:iphone
ID: 24837918
@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
ID: 24837946
sure, I'll post an example of it usage shortly.
0
 
LVL 92

Expert Comment

by:objects
ID: 24837989
               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
ID: 24838014
>>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
ID: 24838026
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
ID: 24838035
>>easier to just make a Runtime.exec() call

To what?
0
 

Author Comment

by:iphone
ID: 24838193
@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
ID: 24838208
:-)
0
 
LVL 92

Expert Comment

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

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

670 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