Access the RS-232 serial port in Java program

Source: Internet
Author: User

Recently, due to project requirements, you have to use the PC end compiled in JavaProgramTo be able to communicate with the terminal and obtain the parameter configuration of the terminal.

Now the debugging is successful. The simple process is as follows:

1. Download commapi in windows. Oracle does not maintain commapi in windows, so you need to download it elsewhere.

2. Copy comm. jar and javax. Comm. properties to % java_home %/lib and JRE/lib respectively.

3. Add comm. jar to the value of the classpath environment variable.

4. Copy win32com. DLL to system32

5. Restart

 

Compile serialdemo:

Modify line 462nd of serialdemo. Java to baudchoice. additem ("115200 ");

Javac *. Java

 

Run serialdemo:

Java serialdemo

 

Environment:

Windows XP

JDK version 1.6.0 _ 24

USB to serial Cable

Wince6.0 Board

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.