Solved

Read from the com port

Posted on 1998-04-02
2
181 Views
Last Modified: 2010-08-05
I have used the method below to open and write to the com port.
I wonder if anybody can help me write a method which reads from the com port.
Please show some example code though I'm not very skilled in JAVA coding, yet :-)

       public void printCom1(String OutPrint)
       {
         if (OutPrint != "")
         {
            PrintWriter out = null;
            try
            {
               out = new PrintWriter(new BufferedWriter(new FileWriter("Com1")));
            }
            catch ( IOException e)
            {}
            out.print(OutPrint);
            out.flush();
            out.close();
       }
0
Comment
Question by:joy3
2 Comments
 

Author Comment

by:joy3
ID: 1233934
I wonder how this will effect the platform independency.
0
 

Accepted Solution

by:
mparekh earned 100 total points
ID: 1233935
SUN has come out with a new API for Communications.
It is available for download at the Java Developer Connection.
This package has sample code to read/write Communication ports.
This package should solve your problem.

http://developer.javasoft.com
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
for i loop in grovy 1 44
Java Message handling in Service Layer 3 55
backtracking recursion  code 19 53
MySQL  on Tomcat 8 24
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now