Search code examples
javarar

Is there a solution to read the RAR files of version 5 using Junrar library?


I'm writing part of Java application responsible for reading archive files of different formats and preparing a preview mode.

Junrar library appeared to be the most reliable to work with RAR format, but it doesn't support the latest version 5 of rar. Only earlier versions are supported.

Junrar dev team confirms this fact here: https://github.com/junrar/junrar/issues/23

Winrar by default creates rar files of version 5, but checkbox 'RAR4' in properties helps to create a file of version 4 - which is perfect to work with. But you have to click it every time you archive the file - that's not a good way (earlier versions of Winrar can't be downloaded from official website).

In my case file is stored as a byte array. I don't need to UNRAR file, i just read it - i need 'name' and 'size' of every file inside of it - thus i prepare preview data of archive content as a small HTML table.

Do you know any other good library to work with Rar format? I can't find any. Or maybe you can imagine some good workarounds?


Solution

  • There is no available solution to unrar RAR5 archives except Winrar itself. You may call it as external program if it is possible on your OS. I am also treating archives of different formats and I am using junrar for extracting RAR, RAR5 archives remain untreated. Junrar initially was developed by Edmund Wagner, and some time ago the support was renewed by Beothorn. But, much to my regret, he is not planning to implement RAR5 support for some reason. I have also checked Raroscope, it does not support RAR 5 neither.

    By the way, another archive, which is not supported by open source java library, is ARJ.