Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds


  Asked By: Darla    Date: Mar 04    Category: Java    Views: 535

I'm working on an application which detects all the attached devices to PC and prints out the device IDs,
I don't know which java function to apply on this purpose!?



3 Answers Found

Answer #1    Answered By: Cambria Lopez     Answered On: Mar 04

java is platform independent, so it doesn't have standard libraries for all hardware devices.
there are some JSR and popular libraries, for some devices  like USB and Bluetooth
JSR 80 and 82

Answer #2    Answered By: Topaz Ramirez     Answered On: Mar 04

The case is something completely native to Java, and that's not the responsibility of JDK to support all native functionalities. Different OSes have different functionalities to drive the devices, however some devices  such as Network Adapters can be detected using JDK.

Try to find native libraries (drivers) for devices you are going to functionalize (maybe some .DLL files for MS Windows, .so files for Linux, or whatever) and using JNI (Java Native Interface) implement your own connector to the devices. (Sometimes you need to code in C/C++)

That's not so hard if you use Netbeans or Eclipse IDEs, they both have C/C++ compilers, and first try to make a HelloWorld using JNI.

You can find here enough resources for manning JNI:

Answer #3    Answered By: Angie Bennett     Answered On: Mar 04

In proc mounted OSs, may look at '/proc/bus/' or its shortcuts (lsusb, lspci).

Didn't find what you were looking for? Find more on Question Or get search suggestion and latest updates.