Java Serial Port Example

Posted on  by 

Active7 years, 10 months ago

Is there a little example of how to write and read a serial port in Java with Windows?

Port - The Serial port to use dataBits - The number of data bits per transfer. Valid values are between 5 and 8 bits. Parity - Select the type of parity checking to use. StopBits - The number of stop bits to use as defined by the enum StopBits. SerialPort public SerialPort (int baudRate, SerialPort.Port port, int dataBits, SerialPort.Parity parity). Open a serial port using Java Communications. case CommPortIdentifier.PORTSERIAL: thePort = thePortID.open('DarwinSys DataComm', TIMEOUTSECONDS. 1000); SerialPort myPort = (SerialPort. Related examples in the same category. Querying Available COM Ports: 2. Printing a File: 3.

Peter Mortensen
14.5k19 gold badges89 silver badges118 bronze badges
JBerta93JBerta93
3792 gold badges9 silver badges25 bronze badges

closed as not constructive by Matthew Farwell, Sai Kalyan Kumar Akshinthala, Nasreddine, Andrew Barber, BalusCNov 17 '11 at 23:26

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers

Java Open A Serial Port

You have to import javax.comm.SerialPort for this purpose to do, refer to Read from a Serial port to know more information.

Sai Kalyan Kumar AkshinthalaSai Kalyan Kumar Akshinthala
10.1k7 gold badges32 silver badges61 bronze badges

Java Serial Port Programming Example

Vlad

Java Serial Port Gui Example

Vlad
7,9932 gold badges27 silver badges32 bronze badges

I used RXTX library.

Example code can be found here: http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port

socha23Java Serial Port Examplesocha23

Java Com Port Example

9,0962 gold badges24 silver badges24 bronze badges

Not the answer you're looking for? Browse other questions tagged javawindowsserial-port or ask your own question.

Coments are closed