Question

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

Was it helpful?

Solution

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

Download URL:

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top