The Java Native Interface (JNI) gives both the ability for JVM implementations to run system native code, and the ability for native code to run Java code (by creating new JVM instances). The most common target languages for JNI are C and C++, for which at least the Sun/Oracle JDK implementations ...

learn more… | top users | synonyms (1)

0
votes
0answers
13 views

JNI - Async task crashing

I'm trying to do the following : Run Java app on Android Call native C++ code from that Java app Create and run a native thread from that natice code return immediatly while the thread keeps running ...
0
votes
1answer
13 views

call main method in java module using JNI

I've been trying to call the main method of a class and pass it some arguments. My code is as below: args = (*env)->NewObjectArray(env, 2, myClass, NULL); arg1 = (*env)->NewStringUTF(env, ...
1
vote
1answer
28 views

Qt does not compile callStaticObjectMethod() it says no matching function to call for

I wrote the following code from this question and it was complied and worked perfect: QAndroidJniObject str = QAndroidJniObject::callStaticObjectMethod<jstring>( ...
0
votes
0answers
14 views

converting jboolean to c bool - JNI [duplicate]

I want to convert jboolean to bool variable in c. For Strings we have GetStringUTFChars which does the job for strings. But how to do it for jboolean ? I have following code : Please note that I am ...
1
vote
1answer
31 views

Calling simple java static method via JNI does not work, though c++ compiles and run it

Considering this Java class with the static method: public class TestClass{ public string str; public TestClass() { str = "Test From Java"; } public static String ...
0
votes
1answer
21 views

JNI - Native method not found when using C++

I've made two test projects, both android applications using JNI. For the first one i did not use Android Tools / Add native support. The native method is defined in a .c file using the C syntax of ...
-2
votes
0answers
31 views

C memory leak JNI

I have my java WEB application which using low lvl C library connected by JNI (Java Native Interface) Everything works fine but as soon I increase load to 400 requests/sec it cashes with error below. ...
1
vote
3answers
30 views

Opencv in android studio does not work?

I'm trying to add native code to my Android app. NDK worked fine with simple C++ code like "Hello from C++", but I need to use openCV, and I am stuck. Project build output: ...
0
votes
0answers
17 views

Deezer sdk android : seek with the TrackPlayer class

I initialized my TrackPlayer like this : trackPlayer = new TrackPlayer((Application) context.getApplicationContext(), deezerConnect, new WifiAndMobileNetworkStateChecker()); ...
0
votes
1answer
17 views

Calling Collections.sort via JNI

I am working on a JNI implementation using C and try to sort a list of type java/lang/List using java/util/Collections sort method with a Comparator. To get the descriptor signatures I mainly use ...
1
vote
1answer
21 views

android - how to escape the ' character while saving encrypted text in sqlLite

I am trying to save encrypted data in sqlLite database. So when the entered data is encrypted, some character might change into ' character which prevents the insertion of record in the database. ...
0
votes
1answer
9 views

onManagerConnected status returning value 2 [Market error]

public class MainActivity2 extends ActionBarActivity { private static final String TAG = "Test Opencv Loadback"; public static String imgPath; private BaseLoaderCallback mLoaderCallback = new ...
-1
votes
0answers
26 views

Method threw 'java.lang.UnsatisfiedLinkError'. Cannot evaluate org.opencv.core.Mat.toString()

public class MainActivity2 extends ActionBarActivity { private static final String TAG = "TEST APPLICATION"; private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Override ...
0
votes
0answers
16 views

Reload native Android library?

I need to "reset" native methods of my Android project and therefore want to reload my Android native library. Is this possible and if yes how? In my Activity in Java the library is loaded as ...
0
votes
1answer
34 views

Exception in thread “main” java.lang.UnsatisfiedLinkError: no opencv_java249 in java.library.path

I'm currently trying to set up OpenCV on my 32-bit laptop, but I keep getting an error message which is confusing me: Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java249 in ...
0
votes
2answers
33 views

Android NDK UnsatisfiedLinkError: “dlopen failed: empty/missing DT_HASH”

I am tracking down crashes with our Android application (which uses the NDK to load a C++ library) using a crash reporting service. A small number of users are experiencing the following crash: ...
0
votes
1answer
23 views

Overload JNI Method

I have an existing JNI method with two parameters. Been around for a while, in use, so I don't want to just change it lest the wrath of angry customers be unleashed. But, I now need to make an ...
0
votes
0answers
32 views

Call native library method in independent native library

I am trying to implement the solution stated in this stackoverflow post. As the solution suggests, I created a independent native library. This how I have implemented that library thus far. #include ...
0
votes
0answers
13 views

JNI - Android Application - Terminated - Fatal Signal

I want to create a Demo application to implement dmTimerCounter using JNI. I am trying to call some pure c code snippet from JNI.Is it possible? dmtimerCounter.c #include ...
0
votes
1answer
15 views

dmTimer using JNI - undefined reference Error

I am trying to run dmTimerCounter using JNI following on this link dmtimerCounter.c /** * \file dmtimerCounter.c * * \brief Sample application for DMTimer. The application will * ...
0
votes
1answer
27 views

AttachCurrentThread crash in multi threads JNI after moving to Android L release

I have implemented a service which is invoked by system server during the boot-up. My service has JNI implementation which creates another thread. The reason for having another thread is to have the ...
0
votes
0answers
17 views

Access the bluetooth api through JNI

How to use Bluetooth QT using JNI? IS there any others possibilities to access the bluetooth api through JNI.
0
votes
1answer
36 views

Android - OpenCV Template Matching

So I'm attempting to follow this example: OpenCV Template Matching example in Android I'm trying to use it with the updated OpenCV Examples which I have working. The difference I'm aware of in the ...
0
votes
2answers
28 views

Questions about JNI on Android

I am planning to create a software that will be compatible with both Windows CE and Android devices. Nothing has been decided yet, but so far I've imagined that I could write most parts of the ...
0
votes
0answers
11 views

Use android's libssl.so and libcrypto.so in native C code

As per this link "building the OpenSSL library for Android devices" "some versions of the Android Java system loader will load the system's version of the OpenSSL library, even though you built and ...
0
votes
1answer
30 views

“UnsatisfiedLinkError: Native method not found” but correct naming?

My native method cannot be found and I cannot solve it. java code: package org.cocos2dx.cppemptytest; public class TestJNI { static { System.loadLibrary("cpp_empty_test"); } ...
1
vote
1answer
24 views

Return array of Mat from jni to java

First i am a new user to Stackoverflow I am SORY for any mistake in this question. I have done my best but havent solved my problem please guide. I have searched a lot before asking this question but ...
0
votes
0answers
22 views

How to load dll library remotely?

I have a remote machine which has an application installed and has its APIs written in C compiled into a dll. I want to interact with the application using the APIs exposed by loading the dll through ...
0
votes
1answer
14 views

Bridj type mapping for unsigned types

When generating BridJ code with JNAerator, it maps unsigned types (for example windows' ULONG) to a normal java long: // c code typedef struct _S { USHORT a; ULONG b; ULONG64 c; } S; ...
0
votes
0answers
8 views

got a 'ERROR: JDWP Unable to get JNI 1.2 …' while running a java program

I got this error while running a java program on eclipse. Doesn't seem like an exception. ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2 JDWP exit error ...
0
votes
0answers
22 views

Why does JNI/JNA segfault with simple calls fprintf(stdout “hello world\n”)?

Is there any reason that a native JNI function should cause a segfault when calling fprintf(stdout, "hello world\n") ? The following succeeds in calling several native functions, but fails at ...
0
votes
1answer
14 views

Fatal Error with JNI on Tomcat

Im doing a Matrix Calculator where I've to do the sum of 2 matrices via JNI. I get my matrices number via user input and this are stored to different 2D arrays. Then I convert both 2d arrays to ...
0
votes
1answer
19 views

Call C++ executables insider Android

I am now porting a linux C++ library to Android using JNI. The library porting itself is very straightforward, and I have built a C++ library that can be invoked by Android via JNI. Now my problem is ...
0
votes
1answer
50 views

Android Studio - NDK/ JNI integration

I have a jni content i got from a third party provider. It also contains the Android.mk and Application.mk. In my app which i have developed in android studio, i need to integrate this jni module. Any ...
0
votes
0answers
85 views
+50

black sprite on jni callback

I've made simple helper class in c++ to call native methods from android. My c++ function: extern "C" { JNIEXPORT void JNICALL Java_org_cocos2dx_cpp_AppActivity_imagePicked(JNIEnv* env, jobject ...
-1
votes
0answers
10 views

Android: JNI or execute .exe?

I need to use the program "dcraw.exe" in my android app to work with .dng files. The easier solution would be invoke the ".exe" file from android code. Is that possible? If not, exists an easier way ...
0
votes
1answer
22 views

Is it possible to update the UI from different thread besides the Main Thread in Android?

I'm having some rough time trying to figure a way arround this problem. I have an Activity, but the UI is too slow to render the entire screen because it is running on the Main thread. I have two main ...
0
votes
0answers
19 views

How to enable coredump for JNI code in Android

I'm writing an Android app that uses huge amounts of JNI-c code (mostly ported from other project). My problem is that my app crashes occasionally. And I've got no way to find out where is the ...
0
votes
0answers
11 views

Best practice way to access Windows Local Machine Certificate Store from Java? [duplicate]

Trying to access keys stuck in the Windows Certificate Store which are in the Local Machine store. MSCAPI is no help since that only provides access to the Current User and Root stores. Is there a ...
0
votes
1answer
23 views

JNI UnsatisfiedLink Error

So I'm new to JNI and I'm following a simple hello word example but I keep getting error UnsatisfiedLinkError. What am I doing wrong? Here's my .h file: /* DO NOT EDIT THIS FILE - it is machine ...
1
vote
3answers
36 views

java.lang.UnsatisfiedLinkError: TestJni.print(LA;)V error on Ubuntu

I know this is an often-seen problem and after search on the web, problem still not solved. -Djava.library.path is already added to the command. Here is my java file public class TestJni { ...
0
votes
0answers
28 views

Can't compile JNI after migrating from Eclipse to Android Studio

I just decided to migrate my Android project from Eclipse to Android Studio. I managed to migrate it without any error after multiple manipulations. However, once I try to compile the project I get ...
0
votes
1answer
19 views

Error in start up MATLAB 2014a (32bit)

After setting up the program ,I meet a fatal error on Startup matlab .As following : Failed to start the Java Virtual machine - JNI error: -3 I want to know where is error and how to solve it ...
0
votes
1answer
14 views

jmethodID in android ART

I'm working on an app. Inside JNI_OnLoad(): jclass cls = (*env)->FindClass(env, "dummy/dummy/dummy/Dummy"); if(cls == NULL) { LOG_ERROR("unable to class"); return; } ...
-1
votes
0answers
27 views

Which thread is responsible for native thread in JNI?

I was doing some experiments in JNI and realized that , what would happen those created native thread if JNI function is return ? for example , when we are calling native method from java class , ...
0
votes
0answers
20 views

How to tell valgrind to ignore SIGSEGV

I have a C++/JNI program that runs fine standalone but exits with SIGSEGV when run with valgrind. I've verified that the signal is thrown from the exact same spot as when running the program in the ...
0
votes
1answer
21 views

Call C++ functions from Java with VM created by C++

I have an native C++ application that creates a JVM (JNI_CreateJavaVM()), which executes a method in a specified class. I now want to call C++ functions from java using JNI. Is it possible to avoid ...
0
votes
1answer
51 views

Calling java function from c++ using jni: Failed to find static method id

I'm creating cocos2d-x game (v. 3.4) on mac os using android sdk 4.2.2, but I tried other too. I want to make NativeHelper class to call some native android stuff from c++. I used this tutorial as the ...
0
votes
0answers
14 views

Keep .so file in RAM and link using JNI in Android

I have requirement of Keeping .so file in RAM and link using JNI in Andorid application. It works perfectly when I keep .so in /data/data/.../lib/ path. Can somebody suggest is it possible to do it?. ...
0
votes
0answers
22 views

How to intercept calls to JNI methods that are not listed in native DLL exports?

I'm in the midst of reverse engineering an MMO that's been built using Java and C++. The game's graphics, networking, physics etc. is implemented via C++ and sit within a single DLL. The game logic is ...