Solved

Read from the com port

Posted on 1998-04-02
2
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

717 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