1

I've looked through a number of the UnsatisfiedLinkError threads on here and nothing seems to quite fit my problem.

I am trying to get this api working: 7ZipBind

However I am having an issue, and cant get the thing to work. I am running some of its example code from the commandline like so:

C:>java -classpath "/sevenzipTest.jar;/sevenzipjbinding-AllWindows.jar;\sevenzipjbinding.jar" com.poc.sevenzip.SevenZipSimple c:\archive\test.zip

However when I try to run it I get the error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Users\XXXX\AppData\Local\Temp\SevenZipJBinding-9640553\lib7-Zip-JBinding.dll: Can't
find dependent libraries
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(Unknown Source)
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.load0(Unknown Source)
        at java.lang.System.load(Unknown Source)
        at net.sf.sevenzipjbinding.SevenZip.initSevenZipFromPlatformJARIntern(SevenZip.java:428)
        at net.sf.sevenzipjbinding.SevenZip.initSevenZipFromPlatformJAR(SevenZip.java:235)
        at net.sf.sevenzipjbinding.SevenZip.ensureLibraryIsInitialized(SevenZip.java:578)
        at net.sf.sevenzipjbinding.SevenZip.openInArchive(SevenZip.java:567)
        at com.poc.sevenzip.SevenZipSimple.runZip(SevenZipSimple.java:25)
        at com.poc.sevenzip.SevenZipSimple.main(SevenZipSimple.java:64

What I am confused about, is why it says it cant locate the libraries (dll files), when the libraries are stored within the <file_path>/sevenzipjbinding-AllWindows.jar file... I am obviously not doing something correct here, and was hoping some1 can give me some pointers.

Cheers

Ally
  • 1,476
  • 3
  • 19
  • 30
  • As far as I know, it is not possible to load the dll directly from the jar-archive...you need to extract them first. http://stackoverflow.com/questions/1611357/how-to-make-a-jar-file-that-include-dll-files – HectorLector May 10 '12 at 13:49

2 Answers2

1

The following instructions are for Windows x86 and 7 Zip JBinding version 4.65-1.05 RC. Download the following DLLs.

Add the DLLs into the Windows-x86 directory in sevenzipjbinding-AllPlatforms.jar. Then append the following lines to sevenzipjbinding-lib.properties in the Windows-x86 directory in the jar.

sevenzipjbinding.libname.3=gpsvc.dll
sevenzipjbinding.libname.4=libgcc_s_dw2-1.dll
sevenzipjbinding.libname.5=libstdc++-6.dll
sevenzipjbinding.libname.6=sysntfy.dll

Instead of modifying the jar file, one could put the DLLs in the PATH (not classpath).

In order to figure this out, I extracted lib7-Zip-JBinding.dll from sevenzipjbinding-AllPlatforms.jar. I then opened the file in Dependency Walker.

Nathan
  • 8,093
  • 8
  • 50
  • 76
1

The bug fix was released. Please, use version 1.06rc or above.

Download URL:

Boris Brodski
  • 8,425
  • 4
  • 40
  • 55