This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

linking a java class and a .so library with GCJ


Hello,

i'm trying to build a simple application that would stay in the system
tray and display some information. Since i didn't program in C++ since
ages, i'd like to stick to java and its api that i know much better.

I base the project on the jdic tray api, that is basically a tray.jar file
and a libtray.so or libtray.dll according to if you want to use this on
windows or linux. Actually i'm coding this on linux but my goal is to run
the software on windows. Unfortunately i don't have a windows box
available for this...

so, i have those files :

-rw-rw-r--  1 alban alban   765 Mar 11 13:25 IconDemo$1.class
-rw-rw-r--  1 alban alban  5503 Mar 11 13:25 IconDemo.class
-rw-rw-r--  1 alban alban  5833 Mar 11 13:25 IconDemo.java
drwxrwxr-x  2 alban alban  4096 Mar 11 10:59 images/
-rw-rw-r--  1 alban alban 17878 Mar 10 09:57 libtray.so
-rwxr--r--  1 alban alban    74 Mar 10 20:30 run-linux.sh*
-rw-rw-r--  1 alban alban 16414 Mar 10 09:57 tray.jar

then i run
gcj --main=IconDemo -o icondemo IconDemo.java --classpath=:.:tray.jar

i got :

/home/alban/tmp/ccsmdU7X.o(.text+0x4b): In function `IconDemo::finit$()':
: undefined reference to
`org::jdesktop::jdic::tray::SystemTray::getDefaultSystemTray()'
/home/alban/tmp/ccsmdU7X.o(.text+0x903): In function `IconDemo::IconDemo()':
: undefined reference to `org::jdesktop::jdic::tray::TrayIcon::class$'
/home/alban/tmp/ccsmdU7X.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/ccsmdU7X.o(.data+0x8): undefined reference to
`org::jdesktop::jdic::tray::SystemTray::class$'
collect2: ld returned 1 exit status

when i run it in the jvm :
java -classpath :.:tray.jar -Djava.library.path=. IconDemo
it works as expected.

what am i missing with GCJ, what options should i use to make it link the
.class with the .so (or .dll on windows) ?

Thanks for help, as you all can see, i'm kind of lost when it comes to C++ :)

Alban


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]