• 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.
With regards
Vineet Bhardwaj
India

[ Edited by Ulf Dittmer: removed email address ]
[ December 10, 2005: Message edited by: Ulf Dittmer ]
 
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...
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Vineet-

Welcome to JavaRanch!

Did Nathans suggestions help you solve the problem?

(I have removed the email address from your post, because we like to keep discussions right here in the forums, so that everybody can benefit from them.)
Enjoy your time here.

Ulf
(Bartender)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!