简体   繁体   English

线程“main”中的异常 java.lang.UnsatisfiedLinkError:java.library.path 中没有 lpsolve55j

[英]Exception in thread “main” java.lang.UnsatisfiedLinkError: no lpsolve55j in java.library.path

in .bashrc is written:在 .bashrc 中是这样写的:

PYTHONPATH="${PYTHONPATH}:$Home/local/lib/python2.7/site-packages/"
export PYTHONPATH 

LD_LIBRARY_PATH="$Home/local/lib/"
export LD_LIBRARY_PATH

CLASSPATH="/home/stud/qe09kyvu/local/lib/liblpsolve55j.so"
export CLASSPATH

When i try to run this command:当我尝试运行此命令时:

java -cp .:../lib/lpsolve55j.jar -Djava.library.path=../liblpsolve55j.so Demo

i get the following error:我收到以下错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lpsolve55j in java.library.path

But i don't understand this error, because in .. there is liblpsolve55j.so但我不明白这个错误,因为在..liblpsolve55j.so

To run lpsolver, you need two things.要运行 lpsolver,您需要做两件事。

  1. platform/os specific binary like listed below and you should keep them in the corresponding library path or export corresponding environment specific property平台/操作系统特定的二进制文件如下所列,您应该将它们保存在相应的库路径中或导出相应的环境特定属性

    • libsolve55.dll for windows - either you should copy these files to system32 or set this path to LD_LIBRARY_PATH environment variable用于 Windows 的 libsolve55.dll - 您应该将这些文件复制到 system32 或将此路径设置为 LD_LIBRARY_PATH 环境变量
    • libsolve55.so for linux - you should copy these files to /usr/local/lib or set this path to LD_LIBRARY_PATH environment variable libsolve55.so for linux - 您应该将这些文件复制到 /usr/local/lib 或将此路径设置为 LD_LIBRARY_PATH 环境变量
    • libsolve55.dylib for mac - you should copy these files to /usr/local/lib or set this path to LD_LIBRARY_PATH environment variable DYLD_FALLBACK_LIBRARY_PATH libsolve55.dylib for mac - 您应该将这些文件复制到 /usr/local/lib 或将此路径设置为 LD_LIBRARY_PATH 环境变量 DYLD_FALLBACK_LIBRARY_PATH
  2. Language specific wrapper for invoking the lp_solver method present in the above binary file.用于调用上述二进制文件中存在的 lp_solver 方法的语言特定包装器。 For Java you need liblpsolve55j.jnilib and lpsolve5j.o file.对于 Java,您需要 liblpsolve55j.jnilib 和 lpsolve5j.o 文件。 Either the location of these should be added to java.library.path or add them to the above platform-specific environment variable.应该将它们的位置添加到 java.library.path 或将它们添加到上述特定于平台的环境变量中。

In your case, it seems like you are all set in step 2, but you are missing the step 1. For Step 1, instead of environment variable, you can include the path in the java.library.path that you are alreay passing.在您的情况下,您似乎都已在第 2 步中完成设置,但您错过了第 1 步。对于第 1 步,您可以将路径包含在您已经传递的 java.library.path 中,而不是环境变量中。 I gave you an example below.我在下面给了你一个例子。

$ java -cp ./Demo.jar:../lib/lpsolve55j.jar -Djava.library.path=/Users/santhoshgandhe/mac_lpsolver/lp_solve_5.5/lpsolve55/bin/osx64:/Users/santhoshgandhe/mac_lpsolver/lp_solve_5.5_java/lib/mac Demo $ java -cp ./Demo.jar:../lib/lpsolve55j.jar -Djava.library.path=/Users/santhoshgandhe/mac_lpsolver/lp_solve_5.5/lpsolve55/bin/osx64:/Users/santhoshgandhe/mac_lpsolver/lp .5_java/lib/mac 演示

Setting the java.library path.设置 java.library 路径。 using Eclipse使用 Eclipse

1.Select your project in the Package Explorer area and press a right click on it. 1. 在 Package Explorer 区域中选择您的项目,然后右键单击它。

2.Select Build Path → Configure Build Path... option. 2.选择构建路径→配置构建路径...选项。

3.In the appearing window, select the Libraries tab. 3.在出现的窗口中,选择库选项卡。

4.Then, expand the JRE System library option and select the Native library location. 4.然后,展开 JRE 系统库选项并选择本机库位置。

5.Click on the Edit... button at the right panel. 5.单击右侧面板上的编辑...按钮。

6.Locate the required library and then click OK. 6. 找到所需的库,然后单击“确定”。

7.Close the window. 7.关闭窗口。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 线程“ main”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有opencv_java2410 - Exception in thread “main” java.lang.UnsatisfiedLinkError: no opencv_java2410 in java.library.path 线程“ main”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有libz3java - Exception in thread “main” java.lang.UnsatisfiedLinkError: no libz3java in java.library.path 线程“主”java.lang.UnsatisfiedLinkError 中的异常:java.library.path 中没有 opencv_java451: - Exception in thread “main” java.lang.UnsatisfiedLinkError: no opencv_java451 in java.library.path: 线程“main”中的异常 java.lang.UnsatisfiedLinkError:java.library.path 中没有 opencv_java249 - Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java249 in java.library.path 线程“ main”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有libopencv_java247 - Exception in thread “main” java.lang.UnsatisfiedLinkError: no libopencv_java247 in java.library.path 线程“ main”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有swt-pi-gtk-3139 - Exception in thread “main” java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3139 in java.library.path 线程“main”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有lwjgl - Exception in thread “main” java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path 线程“ main”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有GurobiJni56 - Exception in thread “main” java.lang.UnsatisfiedLinkError: no GurobiJni56 in java.library.path 线程“ main”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有jniopencv_highgui - Exception in thread “main” java.lang.UnsatisfiedLinkError: no jniopencv_highgui in java.library.path 线程“main”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有jep - Exception in thread “main” java.lang.UnsatisfiedLinkError: no jep in java.library.path
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM