aspose file tools*
The moose likes Groovy and the fly likes JNI calls in the Groovy/Grails Application. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "JNI calls in the Groovy/Grails Application." Watch "JNI calls in the Groovy/Grails Application." New topic
Author

JNI calls in the Groovy/Grails Application.

satya kiran
Ranch Hand

Joined: Nov 07, 2000
Posts: 52
Hi,

I've created the dll file and loading that from the Controller class by calling the system.loadLibrary("test.dll"); The same class is working fine if i create a standalone java application.

When executed, i am getting UnsatisfiedLink Error. I've the below questions.

1. Where should i set the -Djava option so that grails looks at the correct location for the dll.
2. If my controller has package name and the java class that has the native calls does not contain any package name, is it going to be of any issue?
3. Any other suggestions.


Here is what i am trying to do:

TestController.groovy

package com.abc.test.control;

class TestController {

static {
System.loadLibrary("libABCILib");
}

def validateJni ={

Test test = new Test() // Java class that has jni calls
test.create();
}

}

Test.java

public class Test {

// used to hold the C++ object pointer
private long Tesetobj;

// create native object
private native long create();

public Test() {
Testobj = create();

}

}



I am getting below error:

org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.UnsatisfiedLinkError: Test.create()J

at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:92)

at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1062)


Thanks in advance for your help.

Regards,


 
jQuery in Action, 2nd edition
 
subject: JNI calls in the Groovy/Grails Application.
 
Similar Threads
JNI issue in web applications
ActiveX call from JNI
JNI Dll Problem
Problem in running JNI with in servlet
JNI: The specified procedure could not be found.