jni

Can anyone explain what features of the C runtime in Android (via NDK) are not supported?

More specifically, does NDK have a complete STL implementation. We're looking at this for devices running 1.6 and upwards. ...

Loading DLL in Java - Eclipse - JNI

I am trying to load a dll in java using the following code System.loadLibrary("mydll"); The project is placed in D:\development\project\ and i have placed the dll on D:. I then gave following VM argument in eclipse configuration -Djava.library.path=D:/ But when i run i get UnsatisifiedLinkerError. After googling a bit, I used ...

Checking if a Java object is of an array type in JNI

Say I have a MyClass class in Java, is there a way to check in JNI that a jobject is a MyClass[][]? My initial idea was to use env->IsInstanceOf(myobj, myArrayClass), but calling env->FindClass("[MyClass") throws a NoClassDefFoundError. ...

Loading JNI lib on Mac OS X?

Background So I am attempting to load a jnilib (specifically JOGL) into Java on Mac OS X at runtime. I have been following along the relevant Stack Overflow questions: Maven and the JOGL Library Loading DLL in Java - Eclipse - JNI How to make a jar file that include all jar files The end goal for me is to package platform specific J...

Can I mix JNA with JNI

I have a custom dll that I access from Java using JNA. So far all is working perfect. Now however I would like to create Java classes from my C code. I assume this can't be done with JNA so what I did is to create a JNI method but this leads me to UnsatisfiedLinkError's. So my question is: Can I mix JNA and JNI when accessing the same DL...

How do I handle calls to AudioTrack from jni without crashing?

I was trying to write to an AudioTrack from a jni callback, and I get a signal 7 (SIGBUS), fault addr 00000000. I have looked at the Wolf3D example for odroid and they seem to use a android.os.Handler to post a Runnable that will do an update in the correct thread context. I have also tried AttachCurrentThread, but I fail in this case a...

It won't create a Java VM (JNI)

My simple command line app: int _tmain(int argc, _TCHAR* argv[]) { JavaVM *jvm; JNIEnv *env; JavaVMInitArgs vm_args; JavaVMOption options[1]; options[0].optionString = "-Djava.class.path=."; //Path to the java source code vm_args.version = JNI_VERSION_1_6; //JDK version. This indicates version 1.6 vm_args.nOptions = 1; vm_args.o...

Fast way to perform addition of 2 LARGE float arrays in Android. Optional JNI or Opengl ES

I simply need to add floatArray1 to floatArray2 storing the result in floatArray2.. no third array.. all arrays are one dimensional but are very large... probibly as large as the os will let me get away with. Max i would need is two float arrays with 40,000 floats each... but i could get away with 1/10th that i suppose minimum. Would lo...

JNI String Corruption

Hi everyone, I'm getting weird string corruption across JNI calls which is causing problems on the the Java side. Every so often, I'll get a corrupted string in the passed array, which sometimes has existing parts of the original non-corrupted string. The C++ code is supposed to set the first index of the array to the address, it's a nas...

JNI problem when calling a native library that loads another native library

I've got a bit of an odd problem. I have a project in C++ that's basically a wrapper for a third party DLL like this: MyLibrary --loads DLL_A ----loads DLL_B I load DLL_A with LoadLibrary(), wrap several of its functions and generate my own DLL. I've tested this in a C++ project and a C# project. Both do everything they're supposed to ...

JNI cached jclass global reference variables being garbage collected?

I'm working in the JNI Invocation API, calling into Java from C. I have some upfront initialization to cache 30+ Java classes into global references. The results of FindClass are passed into NewGlobalRef to acquire a global reference to the class. I'm caching these class variables to reuse them later. I have 30+ global references to ...

Call any Java method from C#

Is there a way using JNI and C# code to create a program that invoke any given Java method? Assume that I have a jar containing classes hierarchy and I'm responsible for loading the JVM and these classes, can I write a C# program that receives the java method signature + arguments values on the fly and call the java code? Please try to ...

Which JVMs do not support direct java.nio.ByteBuffer?

The release notes for Java NIO (in Java 1.4+) state that support for direct ByteBuffers is an optional feature. I am curious which JVM vendors/flavors do not support it? Should a JNI library always code for managed ByteBuffers and relegate direct ByteBuffers as an optimization? Thanks ...

Comparation in JNI

Here's a"dumb question : can two jstrings be compared in JNI ? if so how ? ...

Android NDK jni problem

I have started teaching myself about the Android NDK and I have followed this example here - http://marakana.com/forums/android/android_examples/49.html I have followed the steps perfectly but when I run the application I get the following error: Trying to load lib /data/data/com.cnetworks.ndk/lib/libndk_demo.so 0x435c2d20 Added shared...

How to call Java method from C++

Hi, I am using JNI to call my C++ function from Java. One of the C++ function's arguments is jobject thiz (as far as I know, all JNI native functions have this argument). The function takes quite long to complete and I want to report progress back to the jobject thiz Java object, so that I can show the progress to the user. How can I cal...

What can I access in Androids Native libraries? And How?

I am completely new to the NDK. I have done a couple of the tutorials including the hello from jni one and another one that calculates the sum of two numbers. They involved using cygwin and the ndk to create the library so file and I have a bit of a grasp on how to insert my own libraries into the libraries layer of Android. I have no...

JNI call to Intel or PPC arch jnilib function differs

I am making a call from within Java to a jnilib function and get different logs on PPC and Intel. My function definitions are as follows: private native int initHandler(long vendorID, long productID); JNIEXPORT jint JNICALL Java_com_sue_protocol_SerialPortObserverThread_initHandler( JNIEnv *env, jobject obj, jlong usbVendor, jlong usbP...

JNI how to access Java Object (Integer)

I have a JNI method to access java method which returns an Integer object. I do not want to return the primitive int type because this code will be modified to handle Generic objects. The following is what I have. I am not able to get the value of the Integer that I pass. The output at C++ side is something like value = 0x4016f3d0 Ho...

Can JNI handle any dll files (Windows)?

I am new to JNI. And have a few questions : Can JNI handle every type dll exists in windows? I wanted to link a library but it gives me error. Is it possible JNI and the dll are not compatible? Excerpt from VB .NET (It works) Private Declare Function ConnectReader Lib "rfidhid.dll" () As Integer Private Declare Function DisconnectRead...