I'm making an addition to Advapi32 and thus have a test in Advapi32Test. I'm trying to run the tests in Eclipse by doing Debug As or Run As a Junit test. The instance the first statement is executed, I get this:
java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/win32-x86-64/jnidispatch.dll) not found in resource path ([file:/C:/Source/jna/dist/win32-x86-64.jar, file:/C:/Source/jna/lib/native/win32-x86-64.jar, file:/C:/Source/jna/contrib/platform/build.eclipse/contrib-test-classes/, file:/C:/Source/jna/contrib/platform/bin/, file:/C:/Program%20Files/eclipse/plugins/org.junit_4.12.0.v201504281640/junit.jar, file:/C:/Program%20Files/eclipse/plugins/org.hamcrest.core_1.3.0.v201303031735.jar, file:/C:/Source/jna/build.eclipse/test-classes/, file:/C:/Source/jna/build.eclipse/classes/, file:/C:/Source/jna/lib/test/reflections-0.9.8.jar, file:/C:/Users/Adam/.eclipse/org.eclipse.platform_4.5.2_1709980481_win32_win32_x86_64/configuration/org.eclipse.osgi/383/0/.cp/, file:/C:/Users/Adam/.eclipse/org.eclipse.platform_4.5.2_1709980481_win32_win32_x86_64/configuration/org.eclipse.osgi/382/0/.cp/])
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:910)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:870)
at com.sun.jna.Native.<clinit>(Native.java:145)
at com.sun.jna.Pointer.<clinit>(Pointer.java:43)
at com.sun.jna.ptr.PointerByReference.<init>(PointerByReference.java:28)
at com.sun.jna.ptr.PointerByReference.<init>(PointerByReference.java:24)
at com.sun.jna.platform.win32.Advapi32Test.testSetSecurityInfoForFileNoSACL(Advapi32Test.java:1123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:252)
at junit.framework.TestSuite.run(TestSuite.java:247)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
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)
So I built the base jna project using ant dist test and then added the resulting win32-x86-64.jar to the classpath, no luck. Also extracted the jnidispatch.dll and put it in the class path. The only way I could get it to work was be to manually put the file explicitly in here: file:/C:/Source/jna/contrib/platform/build.eclipse/contrib-test-classes/com/sun/jna/win32-x86-64/jnidispatch.dll
Is there a more out of the box method to do this? The project was opened as a general eclipse project.