Closed yfhuang521 closed 5 years ago
Hi @yfhuang521,
There is a longstanding issue with loading the libsodium.dll on Windows. As the libsodium.dll is in a JAR it is hard to access it.
Download the latest libsodium-1.0.17-msvc.zip
and find libsodium.dll
. Extract it to a location on your hard drive. For example: C:/Users/username/libsodium.dll
.
Then you can do:
SodiumJava sodium = new SodiumJava("C:/Users/username/libsodium.dll");
Hi @gurpreet- , It still can't work.
Does it still work with D:/libsodium/sodium
?
Or does it work when replacing /
with \
?
I am afraid it did not work at all, because the code linked only SodiumJava.class
but not Sodium.class
. It must be resolved in #50
I have updated Lazysodium with the help of @dmitry-timofeev. Please try either release 3.7.1
or 3.8.0
to fix this issue.
hi, I have a problem. Can anyone help? win10 64-bit java.lang.UnsatisfiedLinkError: Unable to load library 'C:\Users\yfhua\AppData\Local\Temp\libsodium\libsodium.dll': Native library (win32-x86-64/C:\Users\yfhua\AppData\Local\Temp\libsodium\libsodium.dll) not found in resource path ([file:/D:/workspace/lazysodium-java/bin/, file:/C:/Users/yfhua/.p2/pool/plugins/org.junit_4.12.0.v201504281640/junit.jar, file:/C:/Users/yfhua/.p2/pool/plugins/org.hamcrest.core_1.3.0.v201303031735.jar, file:/D:/workspace/lazysodium-java/gradle/wrapper/gradle-wrapper.jar, file:/D:/workspace/lazysodium-java/lib/jna-4.5.1.jar, file:/D:/Program%20Files/eclipse/configuration/org.eclipse.osgi/383/0/.cp/, file:/D:/Program%20Files/eclipse/configuration/org.eclipse.osgi/382/0/.cp/]) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:303) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:427) at com.sun.jna.Native.register(Native.java:1647) at com.goterl.lazycode.lazysodium.utils.NativeUtils.loadLibraryFromJar(NativeUtils.java:109) at com.goterl.lazycode.lazysodium.SodiumJava.registerFromResources(SodiumJava.java:156) at com.goterl.lazycode.lazysodium.SodiumJava.(SodiumJava.java:21)
at lazy.BaseTest.(BaseTest.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)