how to use java to call native interface of linux module
Hi,
Currently I am doing java programming on arm linux for intel Imote2 system. This system has a radio device driver appears as a module on the linux which provide standard interfaces for wireless communication. I want to use java to open this module and call these interface to enable communication of my program. Is there any way that I could load this linux module at runtime, and call the native interface to communicate? It would be great if some one could give me a simple example for doing such stuff.
Thank you !
Song
There's also a "new" project, which is built on top of JNI: JNA
https://jna.dev.java.net/
I don't know if it's possiblie to get it work under an ARM processor and I think it's not final yet, but it could make things easier.
-Puce
Pucea at 2007-7-29 17:02:37 >

Thank you for your information.
But I still got 3 questions.
1. Is it the same of loading library as loading module for java in linux?
2. I am a bit lost for the native method implementation. where to write and save this file and how to write this method?(it looks weird)
3. Does it require to know the original c code implementation in order to write this native method ?
Thank you!
Song
> Thank you for your information.
> But I still got 3 questions.
> 1. Is it the same of loading library as loading
> module for java in linux?
You mean a 3rd party JAR file? No, it's not the same.
> 2. I am a bit lost for the native method
> implementation. where to write and save this file and
> how to write this method?(it looks weird)
It look weird because it's partly C code. The tutorial explains it all pretty well.
> 3. Does it require to know the original c code
> implementation in order to write this native method
> ?
No, but you should write some C code yourself that calls your native method and use that code in your JN-Interface to pass it to Java.