Solved

I/O through the LPT port.

Posted on 1998-02-21
3
303 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
ID: 1233178
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
ID: 1233179
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
ID: 1233180
forgot one
}  // end of the method PrintLPT1


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

679 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