Java.lang.UnsatisfiedLinkError on Linux

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

I compiled the sample code, and now I run the program, and I have 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 on Windows (just adding a DLL to PATH env var), but I'm not sure about Linux.

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

Any tips?

EDIT

After supporting mmyers for problem determination and reading, this thread and this other .

I can say:

My system: Linux 2.6.18-53.el5

My version of GCC (is):

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

Problems: I need gcc 4.2.0

Aaand, apparently there is no gcc 4.2.0 for my system.

I think I have to wait until this happens, or the author recompiles it in the previous version.

mmyers, thank you very much for your help.

+4
source share
2 answers

Have you tried -Djava.library.path=/path/to/library ?

EDIT: After reading the error message again, it seems to me that the downloadable library you are loading is trying to link with glibc version 3.4.9, which apparently has not been installed. Can you check which version of glibc you have? Which Linux distribution do you use?

EDIT2: The problem seems to narrow down to libstdc ++. I guess, but this thread might be useful. He suggests switching to gcc 4.2; from the comments you get version 4.1.2. Let me know if this doesn't work.

+5
source

subes, JXGrabKey dev is here ...

I know little about this error, but your manual on gcc and / or libstdC ++ should be correct.

Personally, I am using the gcc version that ships with Ubuntu 8.10 atm. I always stick with the latest version.

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 need to compile jxgrabkey with the old version of gcc for releases, so is it compatible with the downstream? Does anyone have any wise advice? ^^

+1
source

All Articles