aspose file tools*
The moose likes I/O and Streams and the fly likes communicating with hardwares Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "communicating with hardwares" Watch "communicating with hardwares" New topic
Author

communicating with hardwares

bidmi robson
Greenhorn

Joined: Sep 12, 2010
Posts: 16
how do i writ code that communicate with hardware xample a camera or printer or a wireless device?
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Because java abstracts the os and hardware away it's usually not possible to directly communicate with hardware. However using JNI you can. But there are probably some java API's available to communicate with camera's and printers.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
it's usually not possible to directly communicate with hardware.

I wouldn't say that. Most devices have serial or USB interfaces for which pure Java libraries exist; the JavaIoFaq lists some of them.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Aha I didn't know that there was an javax.usb package. Possible was maybe the wrong word. Impossible is nothing. What I was trying to say is that you need some native code that interacts with the hardware which apparently that package provides.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8968
    
    9

Wouter Oet wrote: What I was trying to say is that you need some native code that interacts with the hardware which apparently that package provides.


Supposedly with Direct Buffers (#6 here), it is possible to write pure Java hardware drivers with just a small JNI code to get the hardware address. Now, I've never actually seen this practice in the wild, but it sure sounds interesting.


[How To Ask Questions On JavaRanch]
 
Consider Paul's rocket mass heater.
 
subject: communicating with hardwares