dcsimg
JNI with forte - IllegalAccessError
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Eitan_Mizrahi
Posted On:   Saturday, October 12, 2002 04:03 PM

I use th JNI for running some dll functions. On command line it works O.K, but there is a problem on Forte - IllegalAccessError on switchLang ... 1) I wrote the program : switchLang.java class switchLang { public native void switch2Eng(); public native void switch2Heb(); static { System.loadLibrary("switchLang"); } public static void main(String[] args){ new switchLang().switch2Eng(); new switchLang().switch2Heb(); } } 2) I compiled the program : javac switchLang.java 3) I did : javah -jni switchLang 4) I programmed a c file : switchlang.cpp #include #include "switchLang.h" #i   More>>

I use th JNI for running some dll functions.
On command line it works O.K, but there is a problem on Forte - IllegalAccessError on switchLang ...

1) I wrote the program : switchLang.java

class switchLang {
public native void switch2Eng();
public native void switch2Heb();

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

public static void main(String[] args){
new switchLang().switch2Eng();
new switchLang().switch2Heb();
}
}
2) I compiled the program : javac switchLang.java
3) I did : javah -jni switchLang
4) I programmed a c file : switchlang.cpp
#include
#include "switchLang.h"
#include

JNIEXPORT void JNICALL Java_switchLang_switch2Eng
(JNIEnv *, jobject) {

long h = (long)(LoadKeyboardLayoutA("00000409", KLF_ACTIVATE));
PostMessage(HWND_BROADCAST, WM_INPUTLANGCHANGEREQUEST, 0x409, h);
return;
}

JNIEXPORT void JNICALL Java_switchLang_switch2Heb
(JNIEnv *, jobject) {
long h = (long)(LoadKeyboardLayoutA("0000040D", KLF_ACTIVATE));
PostMessage(HWND_BROADCAST, WM_INPUTLANGCHANGEREQUEST, 0x40D, h);
return;
}


5) I compiled the above program with borland bcc32 :
create an obj file :
bcc32 -c switchLang.cpp
create a dll file :
bcc32 -tWD switchLang.obj

6) when I tried to run : switchLang.class (same directory)
java switchLang
it works OK.

7) the same as above on FORTE - compile is OK.
8) after compile - in forte (different directory of switchLang) :
IllegalAccessError on switchLang ...

Why ? Any clue ?

Thanks :)

   <<Less
About | Sitemap | Contact