JNI (or JNA, the Java wrapper for it) has already been available for quite a long time. With JNI you write native methods in Java, use javah to create headers for it, then implement the functions inside it with C or C++.
mozammil muzza wrote:Hi All,
Do we have any java API to interact with hardware like c, c++ ?
There's three things that come to mind:
1) Most hardware devices will come with a DLL/so/dylib. You can use the beforementioned JNA project to access them. Unless you absolutely require the last bit of performance (which would require you to use JNI), JNA is perfectly suitable for most applications and, as you requested, pure java.
2) Check out rxtx for working with serial/parallel ports. A lot of devices will emulate a serial port and can be accessed with this tool, too.
3) For directly accessing USB devices, take a look at libusbjava.
Other specialized hardware may actually require some C level code though.