Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7930525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:27:19+00:00 2026-06-03T20:27:19+00:00

i am using java library rxtxx to send data to micro controller the application

  • 0

i am using java library rxtxx to send data to micro controller
the application seems to work but a warning comes up :rxtxx2.1.7 version mismatch
will it affect the sent data ??
I have tested it but no data was sent my code is:

    import java.util.*;
import gnu.io.*;
import java.io.*;



public class portwrit{
    static Enumeration        portList;
    static CommPortIdentifier portId;
   static String msgstr="100";
    static SerialPort         serialPort;
    static OutputStream       outputStream;
    static  InputStream inputStream;
    static  Thread readThread;


    static boolean        outputBufferEmptyFlag = false;

    public static void main(String[] args ) throws NoSuchPortException, PortInUseException {
    boolean portFound = false;
    String defaultPort = "COM6";


    portList = CommPortIdentifier.getPortIdentifiers();

    while (portList.hasMoreElements()) {
        portId = (CommPortIdentifier) portList.nextElement();

        if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {

        if (portId.getName().equals(defaultPort)) {
            System.out.println("Found port " + defaultPort);
            portFound = true;
            try {
            serialPort = 
                (SerialPort) portId.open("SimpleWrite", 2000);
            } catch (PortInUseException e) {
            System.out.println("Port in use.");
            continue;
            } 

            try {
            outputStream = serialPort.getOutputStream();
            } catch (IOException e) {}

            try {
            serialPort.setSerialPortParams(9600, 
                               SerialPort.DATABITS_8, 
                               SerialPort.STOPBITS_1, 
                               SerialPort.PARITY_NONE);
            } catch (UnsupportedCommOperationException e) {}

            try {
                serialPort.notifyOnOutputEmpty(true);
            } catch (Exception e) {
            System.out.println("Error setting event notification");
            System.out.println(e.toString());
            System.exit(-1);
            }

            System.out.println(
                "Writing "+msgstr+"\" to "+serialPort.getName());
            try {
            outputStream.write(Byte.parseByte(msgstr));
            } catch (IOException e) {}

            try {
               Thread.sleep(2000);  // Be sure data is xferred before closing
            } catch (Exception e) {}
            serialPort.close();
            System.exit(1);

        } 
        } 
    } 

    if (!portFound) {
        System.out.println("port " + defaultPort + " not found.");
    } 
    } 


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:27:20+00:00Added an answer on June 3, 2026 at 8:27 pm

    According to this article you may have multiple copies of the RXTX software installed. It suggests looking for comm.jar or RXTXcomm.jar or similar on your path/classpath.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an application using the linkedin-j Java library and JavaLoader, and I
i'm developing a java application using the jstun library (hxxp://jstun.javawi.de/), and i need to
I am using java comm library for serial port communication in my application. When
I'm trying to send an iCal to an outlook, using Java Mail Library, I've
I'm using notnoop APNS Java library to send APNS notifications. Since we have a
Has anyone migrated a an application using Java AWT library to run on Android?
I've been ask to build a multi-threaded java application using the java.util.concurrent library. I'm
I'm using mapquest java library for Android. Actualy I have simple android application with
I want to fetch data from json array using java gson library following is
I am using a java library (edtftpj) to FTP a file from a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.