linking a java class and a .so library with GCJ
Alban Taraire
alban.taraire@netk5.com
Fri Mar 11 07:44:00 GMT 2005
> libtray.so is the JNI native library for tray.jar, right?
as far as i know, yes. To me, tray.jar is a blackbox, i just create a
TrayIcon object from it, and it does whatever it takes to create the tray
icon on the system it's in.
But i'm not sure at all that it uses JNI or not. Are there other ways to
interface C++ things with java ?
> You need to link in tray.jar too, since you're creating
> a fully native executable. Try:
>> gcj --main=IconDemo -fjni -o icondemo IconDemo.java tray.jar
>> (The -fjni is important if tray.jar uses JNI to talk to libtray.so.)
gcj --main=IconDemo -fjni -o netk5_clock IconDemo.java tray.jar
gives :
org/jdesktop/jdic/tray/internal/ServiceManager.class:0: internal compiler
error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:https://qa.mandrakesoft.com/> for instructions.
gcj --main=IconDemo -fjni -o netk5_clock IconDemo.java
--classpath=:.:tray.jar
gives :
/home/alban/tmp/ccaA8iPC.o(.text+0x4b): In function `IconDemo::finit$()':
: undefined reference to
`org::jdesktop::jdic::tray::SystemTray::getDefaultSystemTray()'
/home/alban/tmp/ccaA8iPC.o(.text+0x903): In function `IconDemo::IconDemo()':
: undefined reference to `org::jdesktop::jdic::tray::TrayIcon::class$'
/home/alban/tmp/ccaA8iPC.o(.text+0x921): In function `IconDemo::IconDemo()':
: undefined reference to
`org::jdesktop::jdic::tray::TrayIcon::TrayIcon(javax::swing::Icon*,
java::lang::String*, javax::swing::JPopupMenu*)'
/home/alban/tmp/ccaA8iPC.o(.data+0x8): undefined reference to
`org::jdesktop::jdic::tray::SystemTray::class$'
collect2: ld returned 1 exit status
I'm affraid it means i have to find a libtray.so that uses JNI or
something ? Would you happen to know something like this ? Actually i only
want to have my java tray thing run without a JVM (users should install it
as easily as possible, even if they don't have sun's JRE installed). Maybe
i need to switch totally to C++...
More information about the Java
mailing list