hid4java
hid4java copied to clipboard
Wrapper script to work around issue 161
This PR provides a shell script run_example.sh in the base directory of the repo which can be used to run any of the example files directly with the platform's default 'java' binary. This enables the tests to be run without incurring the delayed and ungraceful shutdown described in #161.
To do this it builds a classpath including the directories within the repository where the mvn-compiled .class files for the library, and its test and example classes are, also the .so files for the amd64 platform (I don't know whether #161 affects other platforms so I haven't attempted to support them).
The line which runs java is qualified with sudo so that the operator doesn't have to worry about udev rules on Linux. I realize that this may not be a good default policy, but it suits me as I am working on a hid4java-dependent project with a couple of devices which will require udev rules and I don't want to put these in place until I am ready to develop the packaging for my project. A consequence of running with sudo is that builds using mvn will also need to be run under sudo so that they can delete runtime files created by test runs. If maintainers want to remove the sudo from the java command and the recommended mvn build command displayed if the .class file for the example test is not found they are welcome to do so.
Finally thanks to @gary-rowe and the other maintainers for their excellent work on hid4java.