简体   繁体   English

UnsatisfiedLinkError,但是库在路径中

[英]UnsatisfiedLinkError, but library is in path

I'm a little confused by this error. 这个错误让我有些困惑。 I'm new to Java and the error seems pretty self explanatory, but I've checked my paths (even defined my own) and it still fails to find this library. 我是Java的新手,但错误似乎很容易解释,但我检查了自己的路径(甚至定义了自己的路径),但仍然找不到该库。 Is there something I'm doing wrong? 我做错了什么吗? See directory screenshot and error screenshot below: 请参阅下面的目录屏幕截图和错误屏幕截图:

编译器错误目录

UPDATE 更新

新错误

UPDATE 2 更新2

If I create a new NetBeans project this works fine. 如果我创建一个新的NetBeans项目,则可以正常工作。 Same code and everything. 相同的代码和所有内容。 If I create new IntelliJ project I get this error above. 如果我创建新的IntelliJ项目,则会在上面收到此错误。 I must be missing something in IntelliJ 我一定在IntelliJ中丢失了一些东西

UPDATE 3 更新3

Found the solution. 找到了解决方案。 Adding dependencies is a bit different in IntelliJ. 在IntelliJ中添加依赖项有点不同。 Thanks all for the help. 谢谢大家的帮助。

http://www.jetbrains.com/idea/webhelp/configuring-module-dependencies-and-libraries.html http://www.jetbrains.com/idea/webhelp/configuring-module-dependencies-and-libraries.html

Obidisc4j is a .jar file. Obidisc4j是一个.jar文件。 You just dont see its extension in the explorer. 您只是没有在资源管理器中看到其扩展名。 Regular jar files are not loaded by System.loadLibrary. 常规的jar文件不会由System.loadLibrary加载。 They are automatically loaded by the JVM's classLoader. 它们由JVM的classLoader自动加载。

You are using a native library. 您正在使用本机库。 It doen't matter if that library is in the classpath. 该库是否在类路径中并不重要。 There are 4 ways you can make the Java runtime load your shared library at runtime: 有四种方法可以使Java运行时在运行时加载共享库:

  1. Call System.load to load the .so from an explicitly specified absolute path. 调用System.load从明确指定的绝对路径加载.so。
  2. Copy the shared library to one of the paths already listed in java.library.path 将共享库复制到java.library.path中已列出的路径之一
  3. Modify the LD_LIBRARY_PATH environment variable to include the directory where the shared library is located. 修改LD_LIBRARY_PATH环境变量以包括共享库所在的目录。
  4. Specify the java.library.path on the command line by using the -D option. 使用-D选项在命令行上指定java.library.path。

Seems like your application is trying to find out a obidisc4j.dll (for Windows) or obidisc4j.so (for Linux). 似乎您的应用程序正在尝试查找obidisc4j.dll (对于Windows)或obidisc4j.so (对于Linux)。 The file must be present on the PATH (but not the classpath). 该文件必须存在于PATH中(而不是类路径中)。 If you are not sure what PATH is your Java application searching in, you can write the following statement, before the point where the exception takes place, to find out the PATH. 如果不确定Java应用程序在搜索哪个PATH,则可以在发生异常之前编写以下语句来查找PATH。

System.out.println(System.getProperty("java.library.path"));

This will tell you about the paths where your DLL or SO file should be placed. 这将告诉您有关放置DLL或SO文件的路径。 You just need to place the file in ONE of those N-paths. 您只需要将文件放在这些N路径之一中即可。

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

相关问题 Java库路径-Mac上的UnsatisfiedLinkError - Java Library Path - UnsatisfiedLinkError on Mac UnsatisfiedLinkError:java.library.path中没有libhello - UnsatisfiedLinkError: no libhello in java.library.path UnsatisfiedLinkError java.library.path中没有慢跑 - UnsatisfiedLinkError no jogl in java.library.path UnsatisfiedLinkError:java.library.path中没有jcprov - UnsatisfiedLinkError: no jcprov in java.library.path UnsatisfiedLinkError:java.library.path中没有nlsxbe - UnsatisfiedLinkError: no nlsxbe in java.library.path UnsatisfiedLinkError - 无法加载库 - 在资源路径中找不到本机库 - UnsatisfiedLinkError - Unable to load library - Native library not found in resource path java.lang.UnsatisfiedLinkError:否 <LIBRARY> 在java.library.path中 - java.lang.UnsatisfiedLinkError: no <LIBRARY> in java.library.path DL4J UnsatisfiedLinkError:java.library.path中没有jniopenblas - DL4J UnsatisfiedLinkError: no jniopenblas in java.library.path java.lang.UnsatisfiedLinkError:lsxbe(在java.library.path中找不到) - java.lang.UnsatisfiedLinkError: lsxbe (Not found in java.library.path) 如何解决&#39;UnsatisfiedLinkError&#39;-java.library.path中没有rxtxSerial-在JArduino中? - How to cure 'UnsatisfiedLinkError' - no rxtxSerial in java.library.path - in JArduino?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM