5

I've managed to get into a linux machine to try the HotKey library suggested in this answer.

I've compiled the sample code and now I run the program and I've got the following message:

[oracle@machine jxgrabkey-0.2.1_i386]$ java -classpath lib/JXGrabKey.jar:Example JXGrabKeyTest

Exception in thread "main" **java.lang.UnsatisfiedLinkError:** /home/oracle/javasample/jxgrabkey-0.2.1_i386/lib/libJXGrabKey.so: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/oracle/javasample/jxgrabkey-0.2.1_i386/lib/libJXGrabKey.so)
   at java.lang.Runtime._load(libgcj.so.7rh)
   at java.lang.Runtime.load(libgcj.so.7rh)
   at java.lang.System.load(libgcj.so.7rh)
   at JXGrabKeyTest.main(JXGrabKeyTest.java:17)

I know how to handle this in Windows ( just by adding the DLL to the PATH env var ) but I'm not that sure about linux.

I've read something about LD_LIBRARY_PATH and some other env vars but I can make it work.

Any advice?

EDIT

After the support from mmyers to indentify the problem and reading this thread and this other.

I can tell:

My system is: Linux 2.6.18-53.el5

My GCC version(s) is ( are) :

gcc-c++-4.1.2-14.el5

gcc-gfortran-4.1.2-14.el5

libgcc-4.1.2-14.el5

gcc-4.1.2-14.el5

The problems is I require gcc 4.2.0

Aaand apparently there is no gcc 4.2.0 for my system.

I guess I would have to wait for it to come or the author recompile it in a previous version.

mmyers, thanks a lot for your help.

Community
  • 1
  • 1
OscarRyz
  • 196,001
  • 113
  • 385
  • 569

2 Answers2

7

Did you try -Djava.library.path=/path/to/library?

EDIT: Re-reading the error message, it looks to me that the native library you're loading is trying to link to glibc version 3.4.9, which apparently is not installed. Can you check what version of glibc you have? What Linux distro are you running?

EDIT2: The problem seems to be narrowed down to libstdc++. I'm about to the edge of my knowledge, but this thread might be useful. It suggests upgrading to gcc 4.2; from the comments, you appear to have version 4.1.2. Let me know if that doesn't work.

Michael Myers
  • 188,989
  • 46
  • 291
  • 292
1

subes, JXGrabKey dev here ...

I don't know much about this error myself, but your lead about gcc and/or libstdc++ should be right

Personally I am using the gcc version shipped with Ubuntu 8.10 atm. I always stick to the latest version shipped.

Current version: g++ (Ubuntu 4.3.2-1ubuntu12) 4.3.2

The following libstdc++ packages are installed on my machine: http://packages.ubuntu.com/intrepid/libstdc++5 http://packages.ubuntu.com/intrepid/libstdc++6

Hope this helps, if you find anything useful, tell me. :) Maybe i have to compile jxgrabkey with an older version of gcc for releases, so it is downwards compatible? Does anyone have a wise advice? ^^

subes
  • 1,832
  • 5
  • 22
  • 28
  • Hey subes! Thank you for the response. Yes, actually a dig further in other forums and the problem was the compiler. So, since the C++ code is available I recompile it with my gcc version, but then I've got _ZNSs4_Rep20_S_empty_rep_storageE :-( :-( I'll try to get that g++ in my installation. Tnx – OscarRyz Feb 17 '09 at 18:46
  • ok, if you find more about it, please tell me if you manage to get it work it would be nice if you could write a wiki article about this on the jxgrabkey wiki on sourceforge ^^ so if other people have the same problems, they can follow your guidelines. (and maybe i can make compatibility releases) – subes Feb 20 '09 at 16:26
  • @subes I'm having the same issue with `WindRiver Workbenck` on `Ubuntu 14.06` that is. I have installed above suggested packages but it still doesn't work for me... do you have any further clues? I read you recompiled the C++ compiler, is this what I have to do, too? My currentr gcc version is `5.4.0` – stdcerr Oct 21 '17 at 19:22
  • You don't need to recompile the C++ compiler, instead you have to recompile the libjxgrabkey.so with your own local compiler so it links to your version of libstdc++. Just run the jxgrabkey/trunk/misc/Ant/build.xml to build a release from this subversion repo: https://sourceforge.net/p/jxgrabkey/code/HEAD/tree/ (you need to have ANT http://ant.apache.org/ installed and some developer c++ dependencies for X11 and so on) – subes Oct 22 '17 at 19:44
  • You can find a more elaborate explanation on how to do this here: https://sourceforge.net/p/jxgrabkey/bugs/6/ maybe this helps too: https://sourceforge.net/p/jxgrabkey/bugs/8/ – subes Oct 22 '17 at 19:56