File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Jni problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Jni problem" Watch "Jni problem" New topic

Jni problem

kamal pathak

Joined: Jul 07, 2006
Posts: 5
I'm calling a dll through jni call in tomcat. I'm able to load the dll and able to call the dll function. The dll internally calls other dll. And that dll call's some files present in the same path as dll. As a stand alone java application everything is working fine. But inside tomcat the dll is not able to find the files which it calls. All dll's and files are in the same path.

What could be the solution? Any suggestion?
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
If the dll is looking for files in the "current path" (very bad design, btw, and also a very common mistake, too), then you might try putting those files in the tomcat\bin folder. However, Windows doesn't gurantee that the current path will stay the same for the life of a process, so don't be surprised if your application works on startup and stops working in between.

When you ran your code in a standalone app, all your files must be in the folder that you started from, which is the current path at startup. However, tomcat starts from tomcat/bin I beleive and your code is looking for files there.
I agree. Here's the link:
subject: Jni problem
It's not a secret anymore!