Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

I/O through the LPT port.

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
ndb
Asked:
ndb
  • 2
1 Solution
 
jhanceCommented:
Only through a native interface to the host operating system.  Java provides no built-in capabilities to access hardware directly.
0
 
shogiCommented:
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
 
shogiCommented:
forgot one
}  // end of the method PrintLPT1


0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now