For example, there are two different JNI methods of the SAME object
class JavaObj{
public native void methodA();
public native void methodB();
}
The JNI headers for these methods could be
JNIEXPORT void JNICALL Java_JavaObj_methodA(JNIEnv * pEnv, jobject javaobj);
JNIEXPORT void JNICALL Java_JavaObj_methodB(JNIEnv * pEnv, job...
I'm using the JNI invocation API, which starts a JVM within a C program; in this situation, you get a JNIEnv pointer which remains valid until you explicitly destroy the JVM.
Does the local/global distinction still apply here? What's the meaning of a local reference to a newly created object, since the JNIEnv remains in scope all the tim...
I could not find any answer related to this question. I wonder if it is possible. Here is my problem.
I have a core processing application written in Fortran. The application needs a new UI. The Fortran code has its own main loop. It communicates
with the UI through a interface routine. This routine calls the main event loo...
I'm using a third party c++ library that uses OpenGL and I'm having problems integrating it with my Java application. More specifically, my program crashes every time I delete the opengl window. I can create the opengl window and display it fine, but when I try to delete it and clean up the resources my program crashes. I've verified ...
I've got some C functions which I am calling through JNI which take a pointer to a structure, and some other functions which will allocate/free a pointer to the same type of structure so that it is a bit easier to deal with my wrapper. Surprisingly, the JNI documentation says very little about how to deal with C structures.
My C header...
how to know what function names inside a dll? So that i can use it in in java with JNI
...
I am trying to use JNI to process large chunks of data using C++ however I am having trouble understanding weather the function SetArrayRegion will duplicate an array element by element or if it can just leave the data in place and return it to the calling java function.
The following documentation is where I have been reading about i...
I'm using Ubuntu 10.10
So that's what I did.
Hello.java:
class Hello {
public native void sayHello();
static { System.loadLibrary("hellolib"); }
public static void main(String[] args){
Hello h = new Hello();
h.sayHello();
}
}
Then I ran the follwing commands:
dierre@...
Greetings,
I could not provide all the details in the question, so here are the key details.
I have a native dll (and a corresponding .so) wrapping a static library, which is created by Eiffel programming language.
I've written a C++ wrapper around the static lib, and I've successfully exposed this to Java. However, if I use this dll ...
Is there a simple and portable way to build JNI - in particular the C components - with an automated build system such as ant or make (or both, with one calling the other) without having to manually input things like the extension of the final library file or the path to the Java includes folder to the C compiler?
...
Hi,
I have a legacy C++ code which is ported to Android. When calling free on strings, a random crash is occurring. Crash is observed in random places. Is there a tool which can be used to check the memory overruns?
...
All,
I'm aware that by default an activity will be killed and restarted when the screen orientation changes, or a keyboard is slid in or out. (See http://stackoverflow.com/questions/456211/activity-restart-on-rotation-android). My question is, what is the correct way to handle this from a Native code perspective? e.g. if I have a sta...
I want to return array of string from JNI to java(actully in android). How to do it?
...
Given:
enum Foo
{
FIRST,
SECOND
}
What is the JNI equivalent for the following code?
Foo foo = ...;
int value;
switch (foo)
{
case FIRST:
value = 1;
break;
case SECOND:
value = 2;
break;
}
I know I can use foo.equals(Foo.FIRST) from JNI, but I'd like to get the same performance as switch(enum). Any ideas?
...
Greetings,
I have an Eclipse plugin (A) which has a dependency on another plugin (B). Plugin B is simply a wrapper around a jar, which contains a native dll, and performs jni functionality.
Given this setup, I have the following code in A's Activator class's start method:
MessageConsole jniConsole = new MessageConsole("Opereffa Output...
Hi all
I'm having an problem with my JNI library.
The execution time of the same code changes from one phone to the other.
I thought it was just because we were testing on an old phone but recently I run on htc legend and all the jni code was slow...
I run the profiler and its really a night and day difference:
on some phone the jni fun...
I have a dll which has a method for e.g void abc(meth* myMeth) and a structure
struct meth
{
int a;
char b[255];
}
The above code code is written in c. I need to map this to Java through JNI, and I am stuck. How can I pass a reference to the method abc as a pointer from a Java method, and how can I set the values of a and b and...
I have a Linux C++ application that creates a JVM and makes JNI calls. I am new to JNI, and so far I the only effective way I have found to debug my application during development is by trial and error. What are some techniques to use to debug the infamous "A fatal error has been detected by the Java Runtime Environment" Java VM crashe...
I have a working implementation of NDK library and corresponding Java-class. But I am not able to add overloaded method to that class. Currently my class contains:
package com.package;
public class MyClass
{
public static native String getFileName();
static
{
System.loadLibrary("mylib");
}
}
My jniwrappers.cpp file has th...
i am currently trying to develop an JNI(Native) component for a Java application, I would like to compile my native components into a Windows DLL, however don't have the time to reinstall windows.
is it was possible to set up MINGW with Netbeans so that i can use the IDE's functions to compile the DLL.
Thanks Lee.
...