Results 1 to 3 of 3
  1. #1
    carek is offline Member
    Join Date
    Dec 2009
    Posts
    9
    Rep Power
    0

    Default Java Native Access (JNA) really simple begginer question

    And the question is what do I do wrong? Here are my codes:
    Java Code:
    package jna;
    
    import com.sun.jna.Library;
    import com.sun.jna.Native;
    
    public interface FFT extends Library {
    	
    	FFT INSTANCE = (FFT)
        Native.loadLibrary("SignalsImpl", FFT.class);
    
    	public int nextpwr2(int size);
    }
    Java Code:
    package jna;
    
    import org.junit.Test;
    
    public class SignalTest {
    	
    	@Test
    	public void ShouldMakeASignalAndLoadNativeLibrary() {
    		FFT.INSTANCE.nextpwr2(10);
    	}
    }
    Exception:
    Java Code:
    java.lang.UnsatisfiedLinkError: Error looking up function 'nextpwr2': The specified procedure could not be found.
    
    	at com.sun.jna.Function.<init>(Function.java:179)
    	at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:345)
    	at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:325)
    	at com.sun.jna.Library$Handler.invoke(Library.java:203)
    	at $Proxy4.nextpwr2(Unknown Source)
    	at jna.SignalTest.ShouldMakeASignalAndLoadNativeLibrary(SignalTest.java:11)
    	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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:44)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
    	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    I've got SignalsImpl.dll in my project directory... why it doesn't work? :( pls help, thx in advance

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    You have not identified 'nextpwr2' to be native.

  3. #3
    carek is offline Member
    Join Date
    Dec 2009
    Posts
    9
    Rep Power
    0

    Default

    actually the problem was that my boss gave me wrong dll :/

Similar Threads

  1. Connection to DLL using Java Native Access
    By cowboy in forum New To Java
    Replies: 1
    Last Post: 01-23-2010, 08:43 PM
  2. Java Native Access (JNA) return types of void *
    By burnumd in forum Advanced Java
    Replies: 5
    Last Post: 01-15-2010, 12:09 AM
  3. Simple Question
    By barusk in forum Networking
    Replies: 13
    Last Post: 03-04-2009, 07:33 PM
  4. Simple question about access
    By tortelini in forum New To Java
    Replies: 6
    Last Post: 09-06-2008, 05:41 PM
  5. Probably a really simple question...
    By ibanez270dx in forum New To Java
    Replies: 0
    Last Post: 11-16-2007, 01:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •