Parallel Port Java Programming

2019-09-15 03:43发布

问题:

how to control data bits of a parallel port via java.actually i am making a project on " WEB BASED POWER HANDLING" in which i have to control devices remotely from other machines over internet through parallel port progrmming.any help?

回答1:

There is not a standard Java API for handling the parallel port so you will have to have the underlying operating system help you.

Most operating system allows talking to external devices - Windows through the "PRN" magic name, Linux through various /dev/files - so if you can do what you want through that, then you are fine.

If not, you will need to find native code that can do what you need, and link it into your Java application through JNI, which can be a very interesting experience. If so, you might get a better result by using a native technology to the platform in question to do this. Most modern languages have web servers as a standard component.



回答2:

Java does not support parallel ports - or any other kind of hardware port, for that matter - out of the box. You will need an external library that contains the native code necessary to communicate with the port of your choice.

You might want to have a look at the RXTX library. It seems that it supports parallel ports to a degree...



回答3:

Do yourself a favour, forget the antique and obsolete Printer port. Since a couple of yea5rs, most computers don't even have one any longer. Check out USB-connected gadgets, such as Arduino: Make a USB Device, Control It In Java