简体   繁体   English

带有Rxtx库的UnsatisfiedLinkError Java

[英]UnsatisfiedLinkError Java with Rxtx library

I am trying to communicate to Arduino with Java, so I'm using the rxtx library. 我正在尝试使用Java与Arduino通信,所以我正在使用rxtx库。 I've downloaded the library and placed the respective files in my java project's folder. 我已经下载了该库并将相应的文件放在我的Java项目的文件夹中。 I put the rxtxxjar in a lib folder in the java project's folder, and I left the serial.jnlib straight into the java project's folder. 我将rxtxxjar放在Java项目文件夹中的lib文件夹中,然后将serial.jnlib直接放入Java项目文件夹中。 I've taken the SerialTest code off of the arduino website, and I've tried to run it but I keep getting the UnsatisfiedLinkError. 我已经从arduino网站上删除了SerialTest代码,并尝试运行它,但是我一直收到UnsatisfiedLinkError。 I've researched this question, and I've seen people saying basically the following in different ways: 我研究了这个问题,并且看到人们基本上以不同的方式讲以下内容:

Go to Project -> properties -> Java build path ->Find your .jar. 转到项目->属性-> Java构建路径->查找您的.jar。 Click on + to open the JAR's properties. 单击+打开JAR的属性。 Select Native library location and edit it to point to RXTX's shared library (.DLL, .so, .dylib). 选择本机库位置,然后编辑它以指向RXTX的共享库(.DLL,.so,.dylib)。

However, I have no idea how to do the pointing to the shared library, especially since I don't see any .dll, .so, or .dylib file, and I cannot use the .jnlib because it is greyed out. 但是,我不知道如何指向共享库,特别是因为我看不到任何.dll,.so或.dylib文件,并且我无法使用.jnlib,因为它是灰色的。 Also on a smaller note, by my .jar is that just the project? 另外,我的.jar文件只是项目吗? I work in Eclipse Java EE. 我在Eclipse Java EE中工作。

You can use 您可以使用

 System.load("Absolute path to your jni library");

This works fine on my project. 这在我的项目上工作正常。

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

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