This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes JNI program works, copy of it doesn't Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JNI program works, copy of it doesn Watch "JNI program works, copy of it doesn New topic
Author

JNI program works, copy of it doesn't

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I have a program that uses JNI to talk to the Attachmate Extra 3270 emulator. Running the main() method executes a little test scenario that works just fine. I copy the source file and paste it into the same package with a new name and WSAD/Eclipse renames everything ok. The copy throws UnsatisfiedLinkError exceptions.

I'm baffled. Any thoughts?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

So you are running the small test from the command line and the packaged app from inside Eclipse? That sounds like a library path problem to me. Try printing out System.getProperty("java.library.path").


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Turns out you cannot rename the class. The functions in the C code inside the dll include the fully qualified classname:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNI program works, copy of it doesn't
 
Similar Threads
Problem calling GetMethodID for constructor
JNI
Importing a value to Java from C/C++ using JNI
How do you call a pdf2txt dll from a java program to convert a pdf file to a text file
How to implement JNI in servlet?