Hallo Leute,
ich habe folgende Exception-fehler(oder wie man das nennt):
Code:
Ich habe zwar gegoogelt, aber hat mir leider nicht wirklich weitergeholfen. Kann mir jemand bei dem Problem weiterhelfen bitte?
mfg
ich habe folgende Exception-fehler(oder wie man das nennt):
Code:
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
Exception in thread "AWT-EventQueue-0" 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:83)
at connection.RS232_Conn.open(RS232_Conn.java:32)
at connection.MainFrame$my_Listener.actionPerformed(MainFrame.java:48)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Code:
Java:
package connection;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.SerialPortEvent;
import gnu.io.SerialPortEventListener;
import java.io.IOException;
import java.io.InputStream;
public class RS232_Conn implements SerialPortEventListener {
private CommPortIdentifier portId;
private SerialPort serialPort;
private InputStream inputStream;
private int baudrate;
private boolean open_success = false;
private boolean close_success = true;
public void serialEvent(SerialPortEvent event) {
System.out.println("serialPortEventlistener");
if(event.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
serialPortDatenVerfuegbar();
}
}
public RS232_Conn(int baudrate) {
this.baudrate = baudrate;
}
public void open() {
if (close_success == true) {
try {
portId = CommPortIdentifier.getPortIdentifier("COM1");
serialPort = (SerialPort) portId.open("Bluetooth_Modul", 2000);
serialPort.setSerialPortParams(baudrate, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
inputStream = serialPort.getInputStream();
serialPort.enableReceiveTimeout(1000);
serialPort.notifyOnDataAvailable(true);
serialPort.addEventListener(this);
open_success = true;
close_success = false;
System.out.println("Open Serialport");
} catch (Exception e) {
System.out.println(e);
}
} else {
System.out.println("Serialport already opened");
}
}
public void close() {
if (open_success == true) {
System.out.println("Close Serialport");
serialPort.close();
open_success = false;
close_success = true;
} else {
System.out.println("Serialport already closed");
}
}
public void serialPortDatenVerfuegbar() {
byte[] read_buffer = new byte[20];
try {
while (inputStream.available() > 0) {
int empfangen = inputStream.read(read_buffer);
System.out.println(empfangen);
}
} catch (IOException ioe) {
System.out.println(ioe);
}
String nachricht = new String(read_buffer);
System.out.println(nachricht);
}
}
Ich habe zwar gegoogelt, aber hat mir leider nicht wirklich weitergeholfen. Kann mir jemand bei dem Problem weiterhelfen bitte?
mfg
Zuletzt bearbeitet: