jni

android excessive global references

Hello guys. I'm occassionally tripping the jni global reference limit for the android emulator. I'm trying to store around 2000 words along with definitions in my application and it's failing at either of two spots: if I use DOM to parse the xml file with all those references it fails when DOM pulls the tree into memory. If I use SAX...

Detecting Memory leaks in Android

How to detect Memory leaks in Android JNI code? I am using Froyo ...

C/C++ header to java

Is there any good tool to generate java (+JNI support if needed) from a header file so that a C or C++ library can be used as-is. Kind of a reverse of javah. The real functionality would be in the C/C++, the Java would be only a shim on top for certain users. I'm no expert on JNI but as far as I can see Javah forces you to do this back...

Android JNI, is there any way C++ code can directly read the app's sqlite database?

I'm working on an Android app with a Java component and a C++ component via JNI. The C++ component is used on other platforms. It would make my life considerably easier if the C++ component could query the existing SQLite database (via the SQLite C API), without having to shell calls out to the Java side. I know it's a long shot, has a...

How do you pronounce JNI?

Serious Java development is new to me, so I've not dealt with the JNI before. Yesterday a co-worker and I were discussing the JNI and the way to pronounce it was in question. Is there a preferred way? In addition to jay-en-eye (j-n-i), I have also heard genie/jeanie. I could easily imagine ginny or jenny. ...

how to convert qt4 QImage into jni jobject type in c++

Hello I try to wrap poppler library by using jni, the most difficult things is to convert QImage into Jobject that can be used later on. anyone can share your exp? Thanks ...

Packaging JNI Libraries

I am using Java to develop an application and I have a library that I need to be able to use. The library has a jar file and a dll file. At the moment I have placed the dll file into my system folder and linked the jar with the IDE. My question is, I want to package everything into a single executable jar in which the user can run (perha...

Java program with 2 native methods declared and defined in C and C++

Can anyone give me an example of a Java program which has two native methods declared and defined in C and C++. Actually, I need a procedure as well as the code, so that I can run it and learn from it, thanks. ...

how to access .dll file in java?

hi guys i have some methods in visual basic 6.0 dll so i need to access in java 6.0 please help me ...

How do i play Audio using JNI?

I've to make an application which has 2 parts: 1) It should record the audio from Android application layer and through JNI it should send the audio data to C library. 2) The C library processes this audio data and send its back to application layer where the processed audio song is played back. i know how to use the Audio Recorder an...

create a simple dll file with JNI

Im trying to create a simple dll file.Im following the tutorial http://java.sun.com/docs/books/jni/html/start.html when i try to compile the c program i get following error : Warning W8057 HelloWorld.c 10: Parameter 'env' is never used in function Java_He lloWorld_print Warning W8057 HelloWorld.c 10: Parameter 'obj' is never used in ...

Best way to do RAW socket programming involving Java.

I have some existing C code that uses ICMP raw sockets to do Ping and I need to use this code in Java as Java does not support ICMP packages. When I wrap the code in JNI and call it, the C code fails to obtain the socket when doing: socket(AF_INET, SOCK_RAW, 1); I guess that Java has dropped some privileges that disables the use of raw...

Java app loads JNI differently when started via Ant

I'm using RXTX in my Java application which includes a JNI library. I placed the .jni file in /Libray/Java/Extensions. When I start my application manually via the usual java -jar /path/to/app.jar everything works fine. However when I try to start it via Netbeans or Ant it fails with [java] java.lang.UnsatisfiedLinkError: /Library/Jav...

How to use Java Runtime.exec() with Windows REG utility to Read/Update/Delete entries in HKEY_LOCAL_MACHINE\...\CurrentVersion\Run?

I want to use Runtime.exec() to update the registry for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run using the Windows REG command utility. Need to be able to add/remove/read an entry from the "Run" key to allow my Swing application to run at startup and check if it is configured to run at startup so I can mark the o...

Exception JNI (Ljava/lang/String;)Ljava/lang/String;

I have made a little program in java that accepts a string as a user input. Now i have made a dll writing its code in Visual C++. when i run my program from netbeans it displays this exception. Exception in thread "main" java.lang.UnsatisfiedLinkError: Prompt.getLine(Ljava/lang/String;)Ljava/lang/String; at Prompt.getLine(Native...

Long lived Java WeakReferences

I am currently trying to diagnose a slow memory leak in my application. The facts I have so far are as follows. I have a heap dump from a 4 day run of the application. This heap dump contains ~800 WeakReference objects which point to objects (all of the same type, which I will call Foo for the purposes of this question) retaining 40mb ...

Java memory Management for JNI

Hi, I have two questions : What if I have a JNI call to a method and the JNI method leaks memory. Once this method completes will the JVM Garbage collector be able to get that memory back. I heard that the JVM does not manage the Heap Space used by JNI ? But the memory used by JNI is a part of the memory used by the Java process ? Is ...

Java runtime error with JNI

I am trying to build and run an example jni program. The program is just a sample helloworld program. I did not write it but I assume that it works. I am running this on Linux. There are four files. HelloNative.c HelloNative.h HelloNative.java HelloNativeTest.java To build the files, I did gcc -I/myDir/jdk/include -I/...

How to use JNI to call MEMCMP from Java

Hi, I need to compare 2 byte arrays and know which one is bigger or if they are equal (just equal or different is not enough). The byte arrays represent a String value of 15 characters or more. This comparison is repeated considerably in my code. I would like to improve the bye array compare by using an equivalent of C++ memcmp metho...

How to call Java methods from C++ in JNI

So I'm writing an Android app which uses a large c++ library. I have everything working so that the java app can call the c++ delegation methods, but I'm finding myself wishing I could log messages from c++ to the Android log. This is easy from java, but I'm at a loss as to how to call a java method from c++. My searches found methods...