Thread: [Java-gnome-developer] win32 java.lang.UnsatisfiedLinkError: gtk_init
Brought to you by:
afcowie
From: Simon G. <si...@sg...> - 2005-03-07 15:09:53
|
I have built gtk-java using MinGW, no problem. But when I try to run anything I get java.lang.UnsatisfiedLinkError: gtk_init Running nm on the gtkjni-2.4.dll produced shows that symbols are e.g. Java_org_gnu_gtk_Gtk_gtk_1init@16 i.e. the native method is called gtk_1init, and not gtk_init. Can someone explain what is going on here. Probably just my ignorance of how JNI is working, but the method names in the jni c sources don't look like they match what is expected in the java sources. Simon. |
From: Jeff M. <ku...@gm...> - 2005-03-07 17:52:50
|
On Mon, 7 Mar 2005 15:21:33 +0000, Simon Godden <si...@sg...> wrote: > I have built gtk-java using MinGW, no problem. > > But when I try to run anything I get > > java.lang.UnsatisfiedLinkError: gtk_init > > Running nm on the gtkjni-2.4.dll produced shows that symbols are e.g. > > Java_org_gnu_gtk_Gtk_gtk_1init@16 > > i.e. the native method is called gtk_1init, and not gtk_init. Simon, the name of the native method is correct. At runtime this name is usually translated so the java code can find the proper JNI method. On the windows platform this translation is not taking place. I reported it to the gcc team via an email about two weeks ago. I still haven't received a response. I will post to the list one more time and follow up with a bugzilla report. > > Can someone explain what is going on here. Probably just my ignorance > of how JNI is working, but the method names in the jni c sources don't > look like they match what is expected in the java sources. The method call is correct. If you run the java file through javah you will see that this is the method created. > > Simon. > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > -- Jeffrey Morgan "The highest reward for a man's toil is not what he gets for it, but what he becomes by it" - Jon Ruskin |
From: Simon G. <si...@sg...> - 2005-03-07 19:42:34
|
On Mon, Mar 07, 2005 at 11:55:14AM -0500, Jeff Morgan wrote: > > Simon, are you using gcc to compile the dll? If not then this is another > clue to the problem. I am using gcc, but not going on to the gcj step (compiling the gtk-2.4.jar to native, which I guess is meant for people wanting to compile their own app to native, which I'm not concerned with). What I meant was that given when I run nm I see the exported symbol of the correct name in gtkjni-2.4.dll, it seems gcc has done its job correctly, and java is doing something wrong. But again I have to admit my knowledge of this area is poor (competent java programmer who can also do a bit of C). Simon |
From: Ka-Hing C. <ka...@gm...> - 2005-03-08 02:29:14
|
I think the problem is that Windows cannot find the dll for GTK (not gtkjava), which causes the failure when JVM tries to load gtkjni-2.4.dll. -khc |
From: Simon G. <si...@sg...> - 2005-03-08 06:54:21
|
On Mon, 2005-03-07 at 18:29 -0800, Ka-Hing Cheung wrote: > I think the problem is that Windows cannot find the dll for GTK (not > gtkjava), which causes the failure when JVM tries to load > gtkjni-2.4.dll. > > -khc I don't think so. If you run the java command from a MS-DOS prompt, then it tells you about any missing DLL dependency that it cannot load, and there are no such messages. As it is Java that is throwing the unsatisfied link error, I believe it must be the definition of a native method that it cannot find, i.e. something within the gtkjni-2.4.dll itself, as suggested by a previous post. If it had successfully found the native method and the problem was something the native method itself was calling, I don't think I would get a UnsatisfiedLinkError, because it would be out of the JVM's hands by then. But I'm no JNI expert, so if someone with more experience could confirm or deny... |
From: Ka-Hing C. <ka...@gm...> - 2005-03-08 07:40:24
|
On Tue, 08 Mar 2005 06:54:11 +0000, Simon Godden <si...@sg...> wrote: > I don't think so. If you run the java command from a MS-DOS prompt, > then it tells you about any missing DLL dependency that it cannot load, > and there are no such messages. > > As it is Java that is throwing the unsatisfied link error, I believe it > must be the definition of a native method that it cannot find, i.e. > something within the gtkjni-2.4.dll itself, as suggested by a previous > post. Perhaps java cannot load gtkjni-2.4.dll because gtkjni-2.4.dll references gtk_init, which is contained in one of the GTK dlls, and since java cannot find the GTK dlls, you get the unsatisfied link error. > If it had successfully found the native method and the problem was > something the native method itself was calling, I don't think I would > get a UnsatisfiedLinkError, because it would be out of the JVM's hands > by then. I haven't done much JNI, but as I recall java throws UnsatisfiedLinkError when what I described above happens. It may also throw the same exception under other conditions though. Getting native libraries to load is not what I would call fun... -khc |