Thirst LibUsb has to be installed on your system:
sudo apt-get install libusb-1.0-0-dev
Then open a new C/C++ Project (A lot of samples are out there) which creates the native .so library which you can then include in your java sample.
On the C/C++ Project in NetBeans include your java JMV directories;
C Compiler // C++ Compiler
General / Include Directories: (On Mint) /usr/lib/jvm/java-8-oracle/include /usr/lib/jvm/java-8-oracle/include/linux
Under Additional Options add: "-lusb"
Under Project Properties --> Linker --> Libraries add the libusb library under following link (on Mint):
or the archive:
Next write your C / C++ program header and source files and include libusb: #include <libusb-1.0/libusb.h>
You can build then C / C++ libraries with "build, or cean and build" which were loaded from your java Program the following way:
You can specify the path and name of the c / c++ lib under: Project Properties --> --> Linker --> Output
and run the native methods this way:
private native void nativeMethod();
I have only included LibUsb over Jni for now and this was the way doing it. You can also search the web for other ways.