title: Error in loading serial port shared library using java
body: <p>I have to send data to serial port, javax.comm is also included but it gives the error
  "Caught java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path while loading driver gnu.io.RXTXCommDriver
  Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
  Caught java.lang.UnsatisfiedLinkError: com.sun.comm.SolarisDriver.readRegistrySerial(Ljava/util/Vector;Ljava/lang/String;)I while loading driver com.sun.comm.SolarisDriver"</p>
  
  <p>I visited all serial port data read write related question in stackoverflow but find no any solution </p>
  
  <p>you kindly help me</p>
  
  <p>the code is below:</p>
  
  <pre><code>package serial;
  import java.io.*;
  import java.util.*;
  import javax.comm.SerialPort;
  import javax.comm.CommPortIdentifier;
  import javax.comm.UnsupportedCommOperationException;
  import javax.comm.PortInUseException;
  
  public class SimpleWrite {
  static Enumeration portList;
  static CommPortIdentifier portId;
  static String messageString = "Hello, world!\n";
  static SerialPort serialPort;
  static OutputStream outputStream;
  
  public static void main(String[] args) {
      portList = CommPortIdentifier.getPortIdentifiers();
  
      while (portList.hasMoreElements()) {
          portId = (CommPortIdentifier) portList.nextElement();
          if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
               if (portId.getName().equals("COM6")) {
              //if (portId.getName().equals("/dev/term/a")) {
                  try {
                      serialPort = (SerialPort)
                          portId.open("SimpleWriteApp", 2000);
                  } catch (PortInUseException e) {}
                  try {
                      outputStream = serialPort.getOutputStream();
                  } catch (IOException e) {}
                  try {
                      serialPort.setSerialPortParams(9600,
                          SerialPort.DATABITS_8,
                          SerialPort.STOPBITS_1,
                          SerialPort.PARITY_NONE);
                  } catch (UnsupportedCommOperationException e) {}
                  try {
                      outputStream.write(messageString.getBytes());
                  } catch (IOException e) {}
              }
          }
      }
  }
  </code></pre>
  
  <p>}</p>