![]() Registered Member ![]()
|
Hi everyone,
I'm trying to write a small java native library in order to access to KDE4 systray from java. Since I'm not very experienced with C++, I first tried a very simple 'hello world library', without any KDE4 code in it. I have created also a CMakeLists.txt file to compile the library. With the following code, everything works fine :
Then I tried to include KDE4 headers into the CMakeLists.txt file (C++ sources not modified, still no KDE4 code), but java complains about an UnsatisfiedLink, because it couldn't find the function in the compiled library. Here's the CMakeLists.txt file with KDE4 headers :
When I run a 'nm -g' to see external symbols on the generated libraries, in the first case I indeed have the exported native java funcion :
but in the second case it doesn't appear anymore, althought it appears in the complete symbol list. I guess that's why java couldn't find it. Any idea on how to make it available ? |
![]() Administrator ![]()
|
Can you please post the Full Sources? You will need to ensure the symbols needed have been exported. ( kde_export.h helps here )
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() KDE Developer ![]()
|
Since the new tray stuff is based on D-Bus, it is probably easier to do this native in Java using the Java D-Bus bindings.
The old and still standard way of system tray integration is most likely already implemented in the Java Class Library or JDIC http://javadesktop.org/articles/jdic/ Cheers, _
anda_skoa, proud to be a member of KDE forums since 2008-Oct.
|
![]() Registered Member ![]()
|
Thank you for your answers !
I managed to solve my problem by debugging cmake execution ; g++ switch -fvisibility=hidden is added when compiling a kde project, that's why I coudn't see the functions in the external symbols of the library. I added a gcc pragma instruction in the header JNI file, and the functions are now visible to java. Everything is explained here : http://gcc.gnu.org/wiki/Visibility You're definitly right, there are implementations of system tray in java, but because of their portability, they lack some functions : for example, with JDIC transparency is not supported. I want a tight integration with the desktop, with notifications, etc. That's why I started with JNI. The D-Bus stuff however sounds very interesting. I'll look into that.
Last edited by La_MouettE on Mon Mar 30, 2009 9:49 pm, edited 1 time in total.
|
Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell