Linux中的java.lang.UnsatisfiedLinkError [英] java.lang.UnsatisfiedLinkError in Linux

查看:734
本文介绍了Linux中的java.lang.UnsatisfiedLinkError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设法进入linux机器来尝试在这个答案。

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)

我知道如何处理这在Windows中(只是通过将DLL添加到PATH env var)但我对linux不太确定。

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.

我已经阅读了一些关于LD_LIBRARY_PATH和其他一些env vars的内容,但我可以使它工作。

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

任何建议?

编辑

在mmyers的支持下确定问题和阅读这个主题这个其他

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

我可以告诉:

我的系统是:Linux 2.6.18-53.el5

My system is: Linux 2.6.18-53.el5

我的GCC版本是:

gcc-c ++ - 4.1.2-14.el5

gcc-c++-4.1.2-14.el5

gcc-gfortran-4.1.2-14.el5

gcc-gfortran-4.1.2-14.el5

libgcc-4.1.2-14.el5

libgcc-4.1.2-14.el5

gcc-4.1.2-14.el5

gcc-4.1.2-14.el5

问题是我需要gcc 4.2.0

The problems is I require gcc 4.2.0

Aaand显然我的系统没有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,非常感谢你的帮助。

mmyers, thanks a lot for your help.

推荐答案

您是否尝试过 -Djava.library.path = / path / to / library

编辑:重新阅读错误消息,它在我看来你正在加载的本机库试图链接到glibc版本3.4.9,显然没有安装。你能看看你有什么版本的glibc吗?您正在运行什么Linux发行版?

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:问题似乎缩小到libstdc ++。我即将知晓,但此主题可能会有用。它建议升级到gcc 4.2;从评论中,您似乎有4.1.2版。如果这不起作用,请告诉我。

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆