Rewording it.
Somebody needs to write the code to interface with the system. Either you have a library that does the work, or you write your own code using JNI that does the work.
If you have a library (which you wrote as "assume that I have a library") then you have a library that does the work. You don't need to do that work yourself. If you have a library then look at the library's instructions.
If you do not have a library then you need to do the work yourself. It can be done although it takes some effort and time. Tools like SWIG are a little complicated to use but can do most of the work for you.