If the device has a fairly simple serial port or parallel port
protocol you can do it from high level java.
Seehttp://mindprod.com/jgloss/serialport.htmlhttp://mindprod.com/jgloss/parallelport.html
For anything else, you need to write a device driver, usually in C++
with a smattering of assembler, then write some glue in C++/JNI to
access the driver from Java.
seehttp://mindprod.com/jgloss/jni.html
--
Roedy Green Canadian Mind Productshttp://mindprod.com
"Humanity is conducting an unintended, uncontrolled, globally pervasive experiment
whose ultimate consequences could be second only to global nuclear war.."
~ Environment Canada (The Canadian equivalent of the EPA on global warming)
Yes, Java is not the first choice for hardware control per se. But, of
course, J2ME is designed to integrate with phones.
You can write a device driver and control hardware. Install Linux.
Write a kernel Module (in C). Make the module talk to hardware. How do
you "talk to hardware"? Take a look at existing opensource device
drivers for examples:
http://lxr.linux.no/linux+v2.6.27.7/drivers/
Linux is all written in C. You could even bypass using JNI altogether
if you simply use a File I/O model. That is, your java code would open
the device as if it were a file and read and write to it. File-based
IO is the basic design of Unix (and therefore Windows NT and Linux).
Thus the serial port driver exposes itself as a file. (the magic
filename tells the OS to hook you to the serial port driver rather
than to the filesystem driver). The serial driver transmits characters
so is called a char mode driver so lives in that part of the source
tree:
http://lxr.linux.no/linux+v2.6.27.7/drivers/char/generic_serial.c
etc.