java.lang.UnsatisfiedLinkError in Linux(Linux 中的 java.lang.UnsatisfiedLinkError)
问题描述
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.
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.
这篇关于Linux 中的 java.lang.UnsatisfiedLinkError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Linux 中的 java.lang.UnsatisfiedLinkError
基础教程推荐
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01