java-native-interface

what is global about the clsStr variable which is “clsStr = (*env)->NewGlobalRef(env,cls)”?

对着背影说爱祢 提交于 2020-01-25 00:24:07
问题 Global Reference in JNI is said to be a reference that has to be manually freed by the programmer. It has nothing to do with the c context. so a code like : { jclass clsStr = (*env)->NewGlobalRef(env,cls); } return clsStr; will give an error saying that clsStr is undefined / undeclared . I understand this. But what i don't understand is the use of these type of references. What is global about clsStr in the above code ? How this variable can be useful in future or after the call returns ? I

JNI to call .NET dll

时光毁灭记忆、已成空白 提交于 2020-01-24 17:45:07
问题 I am trying to create a Java Application that will call C# dll through an intermediate Visula C++ dll, its all well and good when I try to run the .class file from cmd prompt or Eclipse IDE but the problem is in order to do it I need to place the C# dll in the same directory as the Java.exe or else there occurs an exception the the native call, thus making to impossible to build the Java Project, any idea as to how this can be done 回答1: You can enable and register your managed (.NET) dll with

No Implementation found for native in ndk

若如初见. 提交于 2020-01-24 11:29:05
问题 I am struck with an error, using the jni ... I have a simple native method in android activity class and created header for that and implemented the c file for that...unable to find the mistake pls help Here are the files that I have Activity static{ System.loadLibrary("fluidsynth"); } private native String textOverjni(); Header file /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class com_example_fluidsynthtest_MyFluidSynthO */ #ifndef _Included_com

Signal Handling on Linux when using Java/JNI

我与影子孤独终老i 提交于 2020-01-23 14:36:35
问题 I work on an embedded system running on Wind River Linux. It is a mix of Java and C++ with some JNI for communication between technologies. We have build custom error handling so that in the event of any unexpected errors we generate backtraces and other information to help us determine the problem. This error handling is always done by a C++ component that all other components must register with (so that the appropriate signals handlers can be installed). So in the case of a Java component

Signal Handling on Linux when using Java/JNI

安稳与你 提交于 2020-01-23 14:35:24
问题 I work on an embedded system running on Wind River Linux. It is a mix of Java and C++ with some JNI for communication between technologies. We have build custom error handling so that in the event of any unexpected errors we generate backtraces and other information to help us determine the problem. This error handling is always done by a C++ component that all other components must register with (so that the appropriate signals handlers can be installed). So in the case of a Java component

'Symbol lookup error' with netlib-java

∥☆過路亽.° 提交于 2020-01-22 20:56:26
问题 Background & Problem I am having a bit of trouble running the examples in Spark's MLLib on a machine running Fedora 23. I have built Spark 1.6.2 with the following options per Spark documentation: build/mvn -Pnetlib-lgpl -Pyarn -Phadoop-2.4 \ -Dhadoop.version=2.4.0 -DskipTests clean package and upon running the binary classification example: bin/spark-submit --class org.apache.spark.examples.mllib.BinaryClassification \ examples/target/scala-*/spark-examples-*.jar \ --algorithm LR --regType

how to use .dll files in java code?

﹥>﹥吖頭↗ 提交于 2020-01-22 03:00:48
问题 I have a .dll file, which i have to use in java. This .dll file has a parameterised method, which should return type as string. When i am passing parameter to it, i get the message as Native methods do not specify a body Here is the Code... package com.letme.test; public class Eagleye_parser { String n = "E48A7 F7759 65EA7"; public Eagleye_parser() {} static { System.loadLibrary("Eagleye_parser"); } public native String eagleye_fmu(n);// here it is giving msg : Native methods do not specify a

Unable to get JNIEnv* value in arbitrary context

一曲冷凌霜 提交于 2020-01-21 02:15:06
问题 I have an issue with the NDK. In my JNI_OnLoad method, I cache the JavaVm pointer, the class that called the method, and a method id which I use later on: JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved){ JNIEnv *env; cachedJVM = jvm; if((*jvm)->GetEnv(jvm, (void**)&env, JNI_VERSION_1_6)){ LOG_ERROR("Could not get JNIEnv*"); return JNI_ERR; } javaClass = (*env)->FindClass(env, "org/test/opensl/AudioProcessor"); if(javaClass == NULL){ LOG_ERROR("Could not get java class"); return

Cannot resolve corresponding jni function opencv Android

十年热恋 提交于 2020-01-20 07:09:44
问题 this is where i get error.I loaded correctly opencv library but i get this error.If i go in the ximgproc all native methods are red marked with "Cannot resolve corresponding jni function name_function".How can i resolve? protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) { Uri uri = data.getData(); try {

How to reduce the apk size of Android app which need openCv lib( only for Image processing)

半城伤御伤魂 提交于 2020-01-19 21:54:20
问题 I'm building an Android app with min SDK 15 , which uses OpenCV library.The problem is when I build apk size of it is more than 60 MB which is not very great. I checked the app file, I could see that the size is too big due to libopencv_java3.so file in all architectures like amr64 , armeabi , mips , x86 etc. I am using opneCv only for image processing.This library has a lot of other features like video processing, 3d image, object detection and much more, which I don't need in my app like If