You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the example class that was provided in the video, I cloned the repository and did dart run jnigen_example:sum 14 9 but it is giving me a unhandled exception. Lookup for helper library build/jni_libs/libdartjni.dylib failed. Please ensure that dartjni shared library is built. Provided jni:setup script can be used to build the shared library.
Btw, I just was following the instructions from this thread. #672
I need to understand a few things here, do we need to run dart run jni setup everytime? It keeps saying could not find JNI missing java include path, java include path2 awt. I am thinking becuse of this, jnigen is not working in any of my apps
When i run the jni setup command(it fails), i run the javac thing and then run dart run jni_example:sum 17 25 gives me exception, saying lookup for helper library build/jni_lube/libdartjni.dylib failed. Ensure dartjni shared library is built
To explain things further, jnigen is simply using ffi under the hood to call C function (and not Java directly), these C functions use JNI (Java Native Interface), to call Java methods.
dartjni jni
Dart -----------> C ------------> Java
Now Dart needs to have libdartjni.dylib (or dartjni.so on Linux, or ...) to call the C functions, and C needs to have access to libjni.dylib on the PATH to access Java methods.
Therefore you would need to build jni once, and have correct path to Java in your PATH environment variable.
For the example class that was provided in the video, I cloned the repository and did dart run jnigen_example:sum 14 9 but it is giving me a unhandled exception. Lookup for helper library build/jni_libs/libdartjni.dylib failed. Please ensure that dartjni shared library is built. Provided jni:setup script can be used to build the shared library.
Btw, I just was following the instructions from this thread. #672
git clone https://github.com/HosseinYousefi/jnigen_example
cd jnigen_example
dart run jni:setup -p jni -s src/example
javac java/dev/dart/Example.java
dart run jnigen_example:sum 17 25
at the dart run jni_setup -p jni -s src/example part I'm also getting cmake not found. I'm also running on MacOS.
The text was updated successfully, but these errors were encountered: