带有 $LD_LIBRARY_PATH 的 Eclipse

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6666696/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:36:06  来源:igfitidea点击:

Eclipse with $LD_LIBRARY_PATH

javaeclipsepath

提问by user200340

I have some library files built using JNI in the directory /usr/local/lib/.

我在 /usr/local/lib/ 目录中有一些使用 JNI 构建的库文件。

If i start the Eclipse from luncher, the path is never picked up by Eclipse, so I need to specify -Djava.library.path to the Run Configurations.

如果我从 Luncher 启动 Eclipse,则 Eclipse 永远不会选择该路径,因此我需要为运行配置指定 -Djava.library.path。

But if I start the Eclipse from command line. It seems working fine.

但是如果我从命令行启动 Eclipse。看起来工作正常。

Does anyone know why it behaves like this and How to configure it to known the /usr/local/lib/ path from luncher. Thanks.

有谁知道它为什么会这样,以及如何将它配置为知道来自 Luncher 的 /usr/local/lib/ 路径。谢谢。

I am using Eclipse SDK Version: 3.6.2, on Ubuntu OS.

我在 Ubuntu 操作系统上使用 Eclipse SDK 版本:3.6.2。

回答by Aaron Digulla

That is probably because your shell executes export LD_LIBRARY_PATH=...in one of the startup scripts.

这可能是因为您的 shellexport LD_LIBRARY_PATH=...在其中一个启动脚本中执行。

The launcher doesn't run those, so the variable isn't set.

启动器不运行这些,因此未设置变量。

The workaround: Write a small script that sets LD_LIBRARY_PATHand starts Eclipse (use exec eclipseif you want to avoid a useless process hanging around until Eclipse exits).

解决方法:编写一个设置LD_LIBRARY_PATH和启动 Eclipse的小脚本(exec eclipse如果您想避免一个无用的进程在 Eclipse 退出之前挂起,请使用)。

Alternatively, edit eclipse.iniand add -Djava.library.path=...after -vmargs

或者,在之后编辑eclipse.ini并添加-Djava.library.path=...-vmargs

To verify that this works, open Help / About Eclipse / Installation Details / Configuration. The path should show up in the dialog as a System property.

要验证这是否有效,请打开“帮助”/“关于 Eclipse”/“安装详细信息”/“配置”。该路径应作为系统属性显示在对话框中。