Questions tagged [java-native-interface]

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 provide helper commands (javap - for code disassembly, javah for c code generation).

The JNI defines a standard naming and invocation convention which allows the Java virtual machine to locate and invoke native methods.

In fact, JNI is built into the Java virtual machine, allowing the Java virtual machine to invoke local system calls which perform input and output, graphics, networking, and threading operations on the host operating system.

The naming and invocation convention has been standardized by the JNI specification.

References:

9715 questions
4
votes
0 answers

Eclipse external builder export/save configuration?

So if you right click on your project and go properties, under Builders I add the android ndk builder to the project so it will compile the jni stuff when I run my app that im working on. Is there a way to save the builder configuration so that you…
4
votes
1 answer

stop ant build if makefile fails

I have an ant build file that executes a makefile however if the make fails the other rules that…
Chris Camacho
  • 1,164
  • 1
  • 9
  • 31
4
votes
2 answers

Eclipse plugin, call C++ dll

I have an own build Eclipse plugin where I need to call a C++ dll. I tried to do this in two steps : 1. outside my Eclipse-plugin via a Java mainprogram calling the C++ dll 2. try to get it into my plugin (this is where the problem lies) outside…
kahoona
  • 175
  • 2
  • 14
4
votes
1 answer

Incompatible Implicit Declaration of Built-In Function Warning Using NDK with LAME

I'm trying to follow the tutorial located at the following location http://developer.samsung.com/android/technical-docs/Porting-and-using-LAME-MP3-on-Android-with-JNI The gist of this is that it allows one to use the LAME MP3 encoder with JNI. I…
aLearner
  • 1,051
  • 14
  • 30
4
votes
3 answers

Android JNI local reference table, dump current state

Any Android JNI developer should be familiar with this wonderful message in logcat. My question is: how can I tell the VM to dump current table state? I need it for debugging purposes to make sure that native threads at exit have no outstanding…
Pavel P
  • 15,789
  • 11
  • 79
  • 128
4
votes
0 answers

Camera Preview started in C++ but rendered to a Java surface

In Android, is the following possible (if so, how) : I'd like to set up a layout in my java and add a view to it where the view contains a surfaceView for rendering the camera preview. But, I dont want to instantiate and start the camera in Java. …
4
votes
1 answer

java.lang.UnsatisfiedLinkError: Native method not found: Error in jni()

I m trying to do addition of two 2D Array with the use of jni with an android activity. in the android main activity class i make an object of class sample.java. And pass the field of sample class instance to the native code for addition. the…
kapil Gupta
  • 157
  • 1
  • 2
  • 14
4
votes
1 answer

Connecting Kinect to Android

So I'm trying to hook up a Kinect to an Android tablet using any means necessary. I would preferably like to avoid a windows machine or arduino board in the middle. The method I've already tried is to have a C# program (the kinect sdk uses C#)…
user977198
  • 309
  • 2
  • 11
4
votes
1 answer

Getting notified when Windows connects to a network

Is there any way to be notified by windows OS when a new connection is available, in a Java program (using JNI)? At the moment the only way I have to check this is by polling a function that tries to download a webpage. If the download success and…
4
votes
1 answer

JNI - catch exception and check its type

I'm looking for a way to catch an exception that was thrown on the Android (JAVA) side and handle it on the Native side. What i need to do is to detect the type of exception and handle it accordingly. Any idea how it's done ?
refaelos
  • 7,927
  • 7
  • 36
  • 55
4
votes
0 answers

Valgrind with shared libraries jni

I have a shared library that will be called by Java platform via JNI. Would it be possible to check memory leaks in the solib with Valgrnid ? I tried valgrind java -cp bin:libs/junit/junit.jar org.junit.runner.JUnitCore com.test.app ==7902==…
Kamath
  • 4,461
  • 5
  • 33
  • 60
4
votes
1 answer

Output of __android_log_write() not displayed in logcat

I'm working on some native c code for Android and trying to output using this code: __android_log_write(ANDROID_LOG_INFO, "Native", "TEST LOG"); logcat within Eclipse and from the command line both fail to show the message, while showing output…
Mark Murphy
  • 1,580
  • 1
  • 16
  • 29
4
votes
2 answers

hold in "Trying to load lib" and no return for ever

I have a old app written by C++, I am trying to port it to android, and debug it with eclipse, but the project is stopping with an error message : 10-03 12:21:55.344: D/dalvikvm(15262): Trying to load lib /data/data/com.android.test/lib/libtest.so…
coollofty
  • 339
  • 4
  • 15
4
votes
1 answer

How do I "convert" a jobject class to a complex C++ type?

I have a Java class that matches a C++ class. The java class is named SDClass_JNI and the C++ class is called SDClass. I pass the Java class as a jobject param to my JNI method. In that JNI method, I want to then convert that jobject passed in as…
Loren Rogers
  • 325
  • 3
  • 13
4
votes
2 answers

JNI unresolved external symbol __imp_JNI_CreateJavaVM in 64 bit compiler

I'm trying to create JVM usin JNI. I'm using win 7 64 bits OS. On line JNI_CreateJavaVM my program crashes. I decided to compile my program using 64 bit compiler and got following error: Error 1 error LNK2001: unresolved external symbol…
vico
  • 17,051
  • 45
  • 159
  • 315
1 2 3
99
100