Hello Bill,
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;
Project Properties
Build
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:
/usr/lib/x86_64-linux-gnu/libusb-1.0.a
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
static {
System.load("/Path_to_Netbeansfolder/NetBeansProjects/Path_to_Native_Project_Output_Lib_Folder/Library.so");
}
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.
So far,
Peter