[英]How to cure 'UnsatisfiedLinkError' - no rxtxSerial in java.library.path - in JArduino?
package NClang.tinycompile;
import org.sintef.jarduino.DigitalPin;
import org.sintef.jarduino.DigitalState;
import org.sintef.jarduino.JArduino;
import org.sintef.jarduino.PinMode;
import org.sintef.jarduino.comm.Serial4JArduino;
public class Blink extends JArduino {
public Blink(String port) {
super(port);
}
protected void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(DigitalPin.PIN_12, PinMode.OUTPUT);
}
@Override
protected void loop() {
// set the LED on
digitalWrite(DigitalPin.PIN_12, DigitalState.HIGH);
delay(1000); // wait for a second
// set the LED off
digitalWrite(DigitalPin.PIN_12, DigitalState.LOW);
delay(1000); // wait for a second
}
public static void main(String[] args) {
String serialPort;
if (args.length == 1) {
serialPort = args[0];
} else {
serialPort = Serial4JArduino.selectSerialPort();
}
JArduino arduino = new Blink(serialPort);
arduino.runArduinoProcess();
}
}
this is my code for blinking a LED on the Arduino Uno board, but it throws 这是我的代码,用于使Arduino Uno板上的LED闪烁,但是它抛出
Load RxTx
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
at org.sintef.jarduino.comm.Serial4JArduino.getAvailableSerialPorts(Serial4JArduino.java:244)
at org.sintef.jarduino.comm.Serial4JArduino.selectSerialPort(Serial4JArduino.java:289)
at NClang.tinycompile.Blink.main(Blink.java:36)
I have imported the rxtxSerial library to my path, and when I try importing it again it says: 我已经将rxtxSerial库导入了我的路径,当我再次尝试导入它时,它说:
rxtxSerial already in path, no changes have been made
I have looked at some posts about this issue on this website, but they all say something like "to import rxtxSerailcomm.jar and .dll into the right directories. I followed this advice, but still got the exact same error 我已经在该网站上查看了有关此问题的一些帖子,但他们都说了类似“将rxtxSerailcomm.jar和.dll导入正确的目录。我遵循了此建议,但仍然收到完全相同的错误
您需要将org.sintef.jarduino.core-0.1.7-SNAPSHOT.jar
添加到您的构建路径中(右键单击您的项目-> Build Path
org.sintef.jarduino.core-0.1.7-SNAPSHOT.jar
> Configure Build Path
org.sintef.jarduino.core-0.1.7-SNAPSHOT.jar
> Libraries
选项卡)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.