Solved

Accessing the printer port

Posted on 2000-05-11
9
213 Views
Last Modified: 2010-04-01
I have a relay controller hanging of my printer port.  How can I control it in Java.  I can control it in c++ and basic by writing to the adresses.
0
Comment
Question by:cmg05
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 2803761
FileOutputStream fos = new FileOutputStream("PRN");
0
 

Author Comment

by:cmg05
ID: 2803944
But how do I relate that back to the individual adresses acessed in the C++ code for operationg the different relays
0
 
LVL 19

Expert Comment

by:Jim Cakalic
ID: 2805216
Have you looked at the Java Communications API? It contains support for low-level control of parallel ports.
    http://java.sun.com/products/javacomm/index.html

Best regards,
Jim Cakalic
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 16

Expert Comment

by:heyhey_
ID: 2805308
I've used JavaComm for accessing COM ports, but what about LPT ?

>> ... my printer port ...
0
 
LVL 19

Expert Comment

by:Jim Cakalic
ID: 2805336
According to the overview at the referenced page from my previous post, the "Java Communications API contains support for RS232 serial ports and IEEE 1284 parallel ports." Like you, I have used this for serial communications but have not had a need for the parallel port access. But I tend to trust the guys at Sun when they make these kinds of claims.

Jim
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 2805375
ok :)
0
 
LVL 19

Accepted Solution

by:
Jim Cakalic earned 100 total points
ID: 2805405
Actually, I don't know that this really will be the "answer" to the problem as it (the Java Communications package) may still be at too high a level of abstraction. If this is the case, I would think perhaps the direction might be native code wrapped by JNI -- particularly if there is already a C++ implementation and there is not a requirement for portability.
0
 
LVL 7

Expert Comment

by:Ravindra76
ID: 2805523
Yaa. I agree with JIM.

By losing portability only, this problem can be solved.
0
 

Author Comment

by:cmg05
ID: 2808905
not quite what I'd hoped but it sounds like Java does have its limitations.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

856 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