JNI

Understanding safe access of JNI arguments

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm doing some research regarding how HotSpot performs garbage-collection and/or heap-compaction while JNI code is running. It appears to be common knowledge that objects could be moved at any time in Java. I'm trying to understand, definitively if JNI is subject to effects garbage-collection. There exist a number of JNI functions to explicitly prevent garbage-collection; such as GetPrimitiveArrayCritical . It makes sense that such a function exists if the references are indeed volatile. However, it makes no sense if they are not. There

NDK Error occured while importing telegram source code from github

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I downloaded telegram open source code for android from the following the link https://github.com/DrKLO/Telegram . While importing the project am getting the following errors: External Native Build Issues Build command failed. Error while executing process C:\Users\user\AppData\Local\Android\sdk\ndk -bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\user\AndroidStudioProjects\Telegram-master\TMessagesProj\jni\Android.mk NDK_APPLICATION_MK=C:\Users\user\AndroidStudioProjects\Telegram-master\TMessagesProj\jni

Linking static library with JNI

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Java versions prior Java 8 requires native code to be in a shared library, but I've read that with Java 8 it's possible to use static linked libraries with JNI. I have searched for examples but couldn't find any. How can I statically link a JNI library into my java application? 回答1: The Java SE 8 specification has been changed to support static linking, and static linking is implemented in the JDK. This is mentioned briefly in the spec for System.loadLibrary . The sections of the JNI Specification to which it refers are here and here .

Android NDK C++ JNI (no implementation found for native…)

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use the NDK with C++ and can't seem to get the method naming convention correct. my native method is as follows: extern "C" { JNIEXPORT void JNICALL Java_com_test_jnitest_SurfaceRenderer_drawFromJni (JNIEnv* env, jclass c) { // } } with a header wrapped in extern "C" {} aslo. Everything compiles fine, creates a .so file and copies to the libs folder under my project, but when I debug and run in Eclipse I keep getting a log cat message that of "no implementation found for native...". Is there something i'm missing as all the NDK

Calling a DLL from an Applet via JNI

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a "proof of concept" piece of work that crosses over into some unfamiliar territory. I'm tasked with connecting an EFTPOS machine to an application running as an applet in a browser on our intranet. I've ignored the EFTPOS dll for the moment and created a simple JNI decorated DLL in my language of choice (Delphi) that just logs a string to a text file in c:\ and I can call it successfully from a local Java application. However, when I create an applet to do the same thing, compile it into a .JAR, sign the JAR & try to call the method

How to resolve “Could not find JNI”, building OpenCV on Raspberry Pi?

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I try to build opencv with Java on Raspberry Pi (Debian 4.6.3) and get every time an error from cmake: Could not find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH). I used this documentation ( http://docs.opencv.org/doc/tutorials/introduction/desktop_java/java_dev_intro.html#sbt-project-for-java-and-scala ). I have been searching for solution in the Internet for a while. The suggestions were set JAVA_HOME variable, install ant, install python, add ${JAVA_HOME}/bin variable to the PATH variable, set JDK_HOME

How to debug: JNI DETECTED ERROR IN APPLICATION: use of invalid jobject

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am working on a Xamarin Android project, and I get the following error (full log here ) 11-07 08:28:09.067: A/art(7164): art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: use of invalid jobject 0xd4fd90e0 11-07 08:28:09.067: A/art(7164): art/runtime/java_vm_ext.cc:410] "Thread-1973" prio=10 tid=26 Runnable 11-07 08:28:09.067: A/art(7164): art/runtime/java_vm_ext.cc:410] | group="main" sCount=0 dsCount=0 obj=0x137270a0 self=0xc89d4900 11-07 08:28:09.067: A/art(7164): art/runtime/java_vm_ext.cc:410] | sysTid=9034 nice=-11

Android : JNI ERROR (app bug): local reference table overflow (max=512)

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an android app which has native code. The native code needs to get a particular value from java code; this value updates regularly, so I need to get it when I need to use it. I am using JNI to make the call from native code to Java code. std::string val; JNIEnv* env = JSC::Bindings::getJNIEnv(); jclass bridgeClass = env->FindClass("com.mypackage.MyClass"); jmethodID method = env->GetStaticMethodID(bridgeClass, "getVal", "()Ljava/lang/String;"); val = jstringToStdString(env, static_cast<jstring>(env->CallStaticObjectMethod(bridgeClass,

JNI Hello World Unsatisfied Link Error

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This is my first attempt at JNI. My ultimate goal is to get all tasks currently running on a machine, but need to get even a simple example running. I keep getting this error when I try to execute my main program. I have supplied my simple Java main program, the header file generated, and the error. I do not know what this DLL could be dependent on. It was initially referencing a DLL I tracked down and placed into system32 (msvcr90.dll). Here is the command I used to compile the C code as well which produced the DLL, OBJ, LIB, EXP and

Integrate MuPDF Reader in an app

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am working on some stuff that should be able to read PDF in my app and I want to put PDF view in my custom layout . I had preferred Android PDF Viewer but when I performed zoomIn , zoomOut it takes too much time . So currently I am supposed to use MuPDF open source project to integrate in my project, it's based on JNI and I am not used to it. I am using Cygwin to build the library for native code. Hence I am unclear with few things: how to integrate the MuPDF in my project (as per my question title)? once I will succeed to integrated it