dcsimg
JNI InvalidAccessError
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Eitan_Mizrahi
Posted On:   Sunday, October 13, 2002 10:37 AM

When I call a method by JNI interface (by forte) I get an error message : InvalidAccessError java.lang.IllegalAccessError: try to access class switchLang from class MyJApplet ... I did a test to my program as follows at simple code : 1) writing 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(); }    More>>

When I call a method by JNI interface (by forte) I get

an error message : InvalidAccessError

java.lang.IllegalAccessError: try to access class

switchLang from class MyJApplet ...

I did a test to my program as follows at simple code :

1) writing 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) compile the above :

javac switchLang.java

3) make the switchLang.h file :

javah -jni

4) writing 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) compile the above - make the switchLang.obj

bcc32 -c switchLang.cpp

6) compile the above - make the switchLang.dll

bcc32 -tWD switchLang.obj

7) I run the switchLang.class without any problems.

java switchLang

8) I did the same thing in forte - the compilation is OK

9) I run the same in forte - there is an exception as I

described.


10) What can I do to solve the problem.


Thanks :)

   <<Less
About | Sitemap | Contact