I'm finding that Blackdown javah version 1.2 is generating C
prototypes that are missing the package name.
In particular, I have the following in "FitNative.java":
package fit;
public class FitNative
{
static native String realName(String username)
throws NoSuchUserException;
static native String homeDirectory(String username)
throws NoSuchUserException;
static native boolean checkPassword(String username, String password);
static { System.loadLibrary("FitNative"); }
}
I compile the file: "javac FitNative.java".
Then I create the .h file: "javah -jni FitNative".
Then, when I look in "FitNative.h", I see the following prototypes:
JNIEXPORT jboolean JNICALL Java_fit_FitNative_checkPassword
(JNIEnv *, jclass, jstring, jstring);
JNIEXPORT jstring JNICALL Java_fit_FitNative_homeDirectory
(JNIEnv *, jclass, jstring);
JNIEXPORT jstring JNICALL Java_fit_FitNative_realName
(JNIEnv *, jclass, jstring);
If I use those names for my C functions, then at runtime I get a
java.lang.UnsatisfiedLinkError when I try to call one of the native
methods. Instead, I have to edit the "FitNative.h" file so that the
functions include the package name: Java_fit_FitNative_checkPassword,
Java_fit_FitNative_homeDirectory, and Java_fit_FitNative_realName.
Is javah behaving incorrectly or am I invoking it wrong?
Solomon
--
Solomon <|> [EMAIL PROTECTED]
Douglas /|\ http://web.mit.edu/srcd/www/
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]