Making a JNI

So if I want to run some optimized native code but in Java I would have to make a JNI. I’m going to experiment with that. However is it possible to deploy the JNI to the roborio. I’m assuming the libraries would have to be in the deploy folder. Is there anything else I need to do on that front though?

1 Like

The only supported method is creating a vendordep. Robot projects don’t support building JNIs and loading them at runtime due to the complexity involved.

If you already have a JNI .so, you’ll have to load the shared object manually. WPILib usually does that in a static context with some kind of custom *Loader class.

The vendordep template includes a sample JNI. It’s of course possible to include these same Gradle bits into a robot project, but we have no examples of how to do this.