Solved

Accessing the printer port

Posted on 2000-05-11
9
210 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
 
LVL 16

Expert Comment

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

>> ... my printer port ...
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

707 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

13 Experts available now in Live!

Get 1:1 Help Now