Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

communicating with hardwares

 
bidmi robson
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i writ code that communicate with hardware xample a camera or printer or a wireless device?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9298
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic