Solved

I/O through the LPT port.

Posted on 1998-02-21
3
268 Views
Last Modified: 2012-06-27
I've bought a K8000 Kit from Velleman. That's an interface specific for domotica. That interface is connected to my computer through my LPT1 port. Is there somenone who knows how to handle parallel communication in Jave ?
0
Comment
Question by:ndb
  • 2
3 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 100 total points
Comment Utility
Only through a native interface to the host operating system.  Java provides no built-in capabilities to access hardware directly.
0
 
LVL 2

Expert Comment

by:shogi
Comment Utility
You can always do a open file on the LPTx you need, if it's for simple use. Otherwise you need to write C/C++ DLL to the host operating system, and access it with the JNI (java native interface).

Here an example for LPT1 :

public void printLTP1(String OutPrint)
{
  if (OutPrint != "")
  {
     PrintWriter out = null;
     try
     {
        out = new PrintWriter(new BufferedWriter(new FileWriter("lpt1")));
     }
     catch ( IOException e)
     {}
     out.print(OutPrint);
     out.flush();
     out.close();
}

0
 
LVL 2

Expert Comment

by:shogi
Comment Utility
forgot one
}  // end of the method PrintLPT1


0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

743 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

16 Experts available now in Live!

Get 1:1 Help Now