简体   繁体   中英

How do I add a shared library file to the java.library.path in Eclipse?

I'm running Ubuntu 20.04 with Eclipse version 2019-12 and OpenJDK 8 (as my current project requires version 8). The Java project can be successfully executed using this script: 在此处输入图像描述

Working in Eclipse, I want to add an external JAR file to the project, but I keep getting following exception: 在此处输入图像描述

I've tried the following:

1. Adding the native library location containing all the shared libraries 在此处输入图像描述

The depicted location contains the file "libz3java.so". Adding the same native library location to other JARs did not change the result.

2. Setting the java.library.path via VM arguments 在此处输入图像描述

3. Adding an environment variable 在此处输入图像描述

4. Adding the prefix "lib" to the shared library filename

This is the only way I was able to get another exception. I renamed "libz3java.so" to "liblibz3java.so" getting following exception: 在此处输入图像描述

"libz3.so" is another shared library found in the same directory. Adding the prefix "lib" to that library name doesn't change the exception.

How do I tell Eclipse where to find and read the missing shared library?

When adding an environment variable, you have to explicitly use "/home/user/" instead of "~". However, I still don't understand why adding a native library or doing it via VM arguments doesn't work. I recall successfully linking the library as shown in my first attempt with the native library in newer versions (>4.8.6) of Z3 on Ubuntu 16.04.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM