• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help needed regarding Accessing JNI through JSP

 
vineet bhardwaj
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all
Actually i have an JAVA code in which i have called an VC++ DLL using JNI. And this program is working OK as an individual source code. But when i call this JAVA program from JSP it give an runtime error of UnsatisfiedLinkError for an VC++ DLL function "mainp()".
I have set the class path to the dir in which DLL is presen.
Here is the code of JAVA program which implements JNI:

public class test4{
public native void mainp(double loan, double roi, int tenure);

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

public void value(int process,double l, double r, int t) {
double loan =l;
double roi =r;
int tenure =t;
System.out.println("Process ID: " +process);

new test4().mainp(loan,roi,tenure);
}
}

where repayment_new is an DLL which is present in c:\repayment_new\debug\
and the "test4.java" is present in
"c:\tomcat5\webapps\jsp-examples\WEB-INF\repay"
where repay is an package.
I will be highly greatfull to u if you provide the solution.
U can mail the solution to me on : vineet.bharadwaj@gmail.com
With regards
Vineet Bhardwaj
India[EMAIL]vineet.bharadwaj@gmail.com
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CLASSPATH doesn't affect how JNI locates native libraries - the native code has to be in the existing PATH, or you have to specify it using the java.library.path command line property.

Moving to the "Other Java APIs" forum, as this question isn't directly about JSPs...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!