[Java] Can there be a solution that is better than `BoardShim.unpack_from_jar`?
It is not ideal that .dylib files are appearing in the project folder on gradle run. Can there be an option to use another location?
This doc gives some useful information for different places that these files can be. "Context class loader classpath" seems like a good option.
Welcome to BrainFlow project and thanks for your contribution! We will try to fix your issue ASAP. Make sure that you have read about issue format in the docs.
Hi, idk, I didnt find a better option when I was writting it. If context loader classpath works for you feel free to send a PR, it will be great. Another approach to try can be to change env variables
I want to help if I can.
Where are the native library files located originally during java runtime? I don't understand how they are packaged with the java code.
I have cloned the project, and ran mvn package inside of brainflow/java_package/brainflow. The build was successful but looking inside the brainflow-jar-withdependencies.jar, I do not see any library files.
Given the line InputStream link = (BoardShim.class.getResourceAsStream (lib_name)); inside BoardShim.java I expected the library files to somehow be a resource file included in the jar. I must just be misunderstanding something.
you need to compile it first using build.py https://brainflow.readthedocs.io/en/stable/BuildBrainFlow.html#compilation-of-core-module-and-c-binding
And as far as I understand you need to copy files to subfolder like linux-x64, etc https://github.com/brainflow-dev/brainflow/blob/master/java_package/brainflow/pom.xml#L50. Maybe you will need to change files like build.cmake(there are a lot of them, you probably need to run smth like find . -name build.cmake https://github.com/brainflow-dev/brainflow/blob/master/src/board_controller/build.cmake#L172
Also, when you compile it locally you do it only for one OS, while in jar file for releases there are libs for all OSes so this jar is x-platform. Its done by this CI job https://github.com/brainflow-dev/brainflow/blob/master/.github/workflows/deploy.yml, it copies files for all OSes from AWS
Thank you for all the helpful instructions. Here is my PR. It works correctly for Mac but still needs to be generalized to other platforms.
completed