在没有的java.library.path dhtreader [英] No dhtreader in java.library.path

查看:328
本文介绍了在没有的java.library.path dhtreader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让这个行家 PROJEKT 来对树莓派3而DHT11传感器运行给我以下错误:

I try to get this maven projekt to run on the Raspberry Pi 3 but the DHT11 sensor gives me the following error:

sudo java -classpath '.:classes:*:classes:/opt/pi4j/lib/*' com.epam.llpd.greenhouse.web.ServerStarter

java.lang.UnsatisfiedLinkError: no dhtreader in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at com.epam.llpd.greenhouse.sensor.Sensor.<clinit>(Sensor.java:16)
    at com.epam.llpd.greenhouse.PiHardwareController$1.run(PiHardwareController.java:132)

在文件夹的\\ src \\主\\ java的\\ COM \\ EPAM \\ LLPD \\温室\\传感器还有就是 dhtreader.c 文件。

In the folder \src\main\java\com\epam\llpd\greenhouse\sensor there is the dhtreader.c file.

我做编译的二进制OBJEKT使用下面的命令:

I did compile a binary objekt with the following command:

gcc -o dhtreader.so -lc -shared -I/usr/lib/jvm/jdk-7-oracle-arm-vfp-hflt/include -I/usr/lib/jvm/jdk-7-oracle-arm-vfp-hflt/include/linux dhtreader.c -l bcm2835

dhtreader.so 放置在同一文件夹中的.jar

The dhtreader.so is placed in the same folder as the .jar.

该dhtreader.c文件特定的树莓派使用DHT11和DHT22传感器常见的C类,它是在许多树莓派项目中,拥有很多像<一个来源href=\"https://$c$c.ga-fl.net/cgz/jacuzzi/tree/913b3e809831b2e6a04f9e31c52bf03ea4176d38/var/jacuzzi/lib/Adafruit-Raspberry-Pi-Python-$c$c-master/Adafruit_DHT_Driver_Python\"相对=nofollow>这个。

The dhtreader.c file is a common C class specific for the Raspberry Pi to use the DHT11 and DHT22 sensor and it is used in many Raspberry Pi projects and has alot of sources like this one.

该C级(dhtreader.c)通过使用。 JNI / C,但它只是没有因为上述错误的工作。

This C class (dhtreader.c) is used via. JNI/C but it just doesn't work because of the error above.

我试过媒体链接设置的java.library.path 使用Java下面的方法主要:

I allready tried to set the java.library.path with the following method in the java main:

System.setProperty("java.library.path", "./");

这并没有帮助。相反,我加入 -Djava.library.path = / 来java命令:

That didn't help. Instead i added -Djava.library.path=./ to the java command:

sudo java -classpath '.:classes:*:classes:/opt/pi4j/lib/*' com.epam.llpd.greenhouse.web.ServerStarter -Djava.library.path=./

但是,这并没有帮助也没有。

But that didn't help neither.

现在却困,不知道如何 dhtreader.so 添加到的java.library.path

Now i'm stuck and don't know how to add the dhtreader.so to the java.library.path.

如何添加 dhtreader.so 的java.library.path

How do i add the dhtreader.so to the java.library.path?

我问在<一个href=\"http://raspberrypi.stackexchange.com/questions/48064/no-dhtreader-in-java-library-path\">Raspberry丕StackExchange 的第一,但他们认为,这是题外话。

I asked in the Raspberry Pi StackExchange first but they thought that it's off-topic.

推荐答案

尽量简单 dhtreader.so 重命名为 libdhtreader.so

事实上,当我们调用的System.loadLibrary(富)在Java库的预期名称为:

Indeed when we call System.loadLibrary("foo") in java the expected name of the library is:


  • Windows系统: foo.dll

  • 的Unix / Linux: libfoo.so

  • 的Mac libfoo.jnilib

  • Windows: foo.dll
  • Unix/Linux: libfoo.so
  • Mac: libfoo.jnilib

尝试推出它作为下一个:

Try to launch it as next:

sudo java -Djava.library.path=./lib -classpath '.:classes:*:classes:/opt/pi4j/lib/*' com.epam.llpd.greenhouse.web.ServerStarter

注:上面的命令假定你的LIB位于lib目录本身就是坐落在命令已启动目录

NB: The command above assumes that your lib is located in the lib directory that is itself located in the directory where the command has been launched.

这篇关于在没有的java.library.path dhtreader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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