Solved

Read from the com port

Posted on 1998-04-02
2
171 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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 first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

757 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

18 Experts available now in Live!

Get 1:1 Help Now