Hiii all
I am using java 1.6 and RXTXComm package (Javax.comm) package.
I can read data from a electronic weighing machine. Now I have to set the weight as zero. I can tare this weight by sending T command to serial port. I had tried several times but no response from device. Somebody please help me.

this is my code snippet

public class WriteToSerialPort {
    CommPortIdentifier pid;
    SerialPort serial;
    java.io.OutputStream outstream;
    public void writeToPort() throws Exception
        CommPortIdentifier pid=CommPortIdentifier.getPortIdentifier("COM1");
        serial=(SerialPort)pid.open("test app",1000);
        char tare=(char)84;


    public static void main(String args[])throws Exception
        WriteToSerialPort ob=new WriteToSerialPort();

thanks in advance

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

I think you should flush the outputstream after you have written data to it.


Hello azibhai4u
I am using java 1.6 and RXTXComm package (Javax.comm) package.
HOW can I read data from a electronic weighing machine?
Please help give source code................

hey, Javax.comm package isn't supported for windows :(
how can I get this? how can I program my serial port - a very simple code just to open a port and see its working?

This article has been dead for over six months. Start a new discussion instead.