如何在Linux中将.so文件添加到java.library.path [英] How to add .so file to the java.library.path in Linux

查看:206
本文介绍了如何在Linux中将.so文件添加到java.library.path的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个Java应用程序,该应用程序需要Windows中java.library.path中的.dll文件.要在Linux中运行相同的应用程序,我有相应的.so文件,应将其添加到linux计算机的java.library.path中,到目前为止,我没有找到任何简单的解决方案

I am working with a java application which needs a .dll file in java.library.path in windows. To run same application in Linux I have the respective .so file which should be added to java.library.path in linux machine, I didnt find any easy solution for this so far

我确实将.so放在了类路径中已经存在的文件夹中,但是我的应用程序仍然抱怨java.library.path

I did put the .so in a folder which is already in the class path, but my application still complains there is no required .so file in java.library.path

我想找到:

  1. .so添加到java.library.path的方法
  2. 如何知道它是否已经添加(添加时)
  1. Ways to add .so to java.library.path
  2. How to know if its already added (when added)

推荐答案

在启动应用程序之前将包含目录添加到LD_LIBRARY_PATH

Add the containing directory to LD_LIBRARY_PATH before launching the application

        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/some/pathOfContainingDirectory

使用java -XshowSettings:properties显示java.library.path(和其他)值.

Use java -XshowSettings:properties to show the java.library.path (and others) value.

这篇关于如何在Linux中将.so文件添加到java.library.path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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