No Java-Gui when using the Invocation API?

Hi,

I've got a Java-class that includes a GUI. If I create an instance of that class in Java , there are no problems. The GUI becomes invoked.

But if I try to instanciate this class from the native side (the class is found and also the constructor) I get no reference to it and no GUI appears. The jobject value that is returned from the NewObject function is null.

It seems that the constructor can not be invoked.

This is the constructor:

public x()

{

enableEvents(AWTEvent.WINDOW_EVENT_MASK);

try {jbInit();}

catch(Exception e) {e.printStackTrace();}

}

Not very complicated I guess. It was created with JBuilder.

Is there a general problem with Java-GUI's? Or do I have to do something special?

thanks for your help,

Robert

[833 byte] By [tailorman] at [2007-9-26 9:25:15]
# 1

Hi,

I have already had some similar silent "nothing works" in JNI when calling the JVM from external program.

The issue I had (and which may also be yours), was that 'C' functions that mapped native methods, and that were already in my program, were not known by the JVM. (name mangling mappping, a la 'Java_com_...' did not work).

I had to explicitly register each function for each method using (*env)->RegisterNatives(env....) from JNIEnv struct.

As you are using AWT, there are some Dlls (or .so) libraries that must be loaded. Maybe, for some unknown reason, those libraries are not reached.

Hope this helps.

C.Dore

cdore at 2007-7-1 20:45:20 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

Hi

I had such a problem some time ago :

Another reason, beside the first given by <i>cdore</i> could be

that the classpath of your VM loaded from the native code is not

complete. There may be missing jars . That's why my own Gui didn't load.

hope this help.

Regards

Florent

Invisible_Ghost at 2007-7-1 20:45:20 > top of Java-index,Java HotSpot Virtual Machine,Specifications...