jni

This method jboolean (JNICALL *ExceptionCheck) (JNIEnv *env) where is defined???

I'm interested in the definition of this method. But I've found only the declaration in the jni.h file.... There must be an implementation somewhere I guess! :) Thanks ...

using functions in dll, in java

Hi, I have some dll files(not custom and not written by me) and I need to use the functions, that are c/c++ written, in these files in my java project. I googled and read many examples about JNI but they were all about writing your own program and dll and then reaching them. Also I don't think dllexport exists in these dlls, so dllimport...

Performance of C++ calls to Java code vs C# code

I am exploring a solution at my client where we have to call an API that is available in both C# and Java from our C++ application. We would like this to be a cross platform application (PC & Mac), so Java is preferred, but performance is more important. I've been trying to do some research on the performance of C++ calls to C# vs Java...

How does Java standard libraries comunicate with native code?

Do they use something like Mono's PInvoke? Or is it more like internal calls registered before the runtime is started? Does java have a base library for handling native calls like mscorlib.dll? If I want to invoke a JVM in C code will it libraries look for the .so/.dll files? Does it make a difference to Java standard libraries if I stat...

How can my .so find its dependent .so in different Ubuntu version?

Hi Everyone? I have one libA.so. It is used by JNI method. And I have two different version of Ubuntu. One is Ubuntu 8.04 and the other is Ubuntu 9.10. libA.so has a dependency. libA.so depends on libB.so and libB.so depends on libC.so. ie. libA.so -> libB.so -> libC.so (Actually libB.so and libC.so are related with GTK) The li...

JNI method returns old data

Hello all. I've spent whole day on this problem and still have no idea how to solve it. Here is the simplified code JAVA class javaclass{ private volatile boolean isTerminated; public void javamethod() { log.logInfo("java :"+isTerminated()); } public int isTerminated() { return (isTerminated) ? 1 : 0; } public ...

JNI - How to create a library for different classes

Hi, I'm new to JNI, i'm developing a native library for an Android project. I read some papers about JNI programming but i didn't understand if it is possible to create a library that can be loaded in different project classes with different packages. I read that to declare a new JNI method the syntax is: the prefix "Java_" an encoded...

using JNI libraries in ubuntu

Im am trying to use a JNI library but unable to locate where the .so files are on my ubuntu machine? The reason I need to find it is because I suspect Im using an older version and like to replace it with a newer one. Its more of an ubuntu question rather than jni. Any help is appreciated. ...

JNI does not work on the Eclipse

Hi Everyone, With a lot of efforts,Finally I can identify my previous problems more clearly. My environment is as following. Eclipse version: 3.5.2 Java version: 1.6.0_20 OS: Ubuntu 8.04 I have a SO file. And I have a JNI method which uses SO file. If JNI method is called with specific parameters from Application wh...

Unsatisified linker error using JNI

Hello, I wrote a Java class which accesses a method in the C dll through Jni. But i am getting the following error in windows. java.lang.UnsatisfiedLinkError: Server.getNetworkDiagram(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; Guess it is able to load the library. Also i am building the .dll (for window...

uint64_t to int

I'm writing a java binding for a C code and I'm not really familiar with C. I have a uint64_t and need to cast it to a int. Does anyone know how to do that? (My binding returns then a jint...) ...

Running JVM inside Windows C console app becomes zombie if debugging is stopped in the middle

I wrote a C program that starts a JVM using JNI_CreateJavaVM. The program is a Windows console application (VC 2008). JNI version is 1.6. If I debug the program and then stop the debugging in the middle, before it reaches the call to DestroyJavaVM then the CMD.exe window remains open and I'm unable to close or kill it. If I look at the ...

Embed external application inside Java application (or fake it)

I have a java application that will run on Windows 7 (using Swing, App #1) that runs as full screen (but not in exclusive mode). I have another application (App #2) that displays a GUI to configure an external device over a serial port that I do not have the source to and cannot change at all. I want to embed App #2 inside of App #1 ...

Problem with SWIG generated JNI code on Android

I want to generate JNI wrappers from C/C++ code. Here is my interface file. /* aes_security.i */ %module jni_security_example %{ #include "pbkdf2.h" %} extern int pbkdf2_sha1 (const char *passphrase, size_t passphraseLength, const char *SSID, size_t SSIDlen, unsigned int iterationCount, char *aeskey, size_t ke...

Detect Java location from Makefile

Hello, I have a makefile, which needs to know the location of the Java include directory because it makes use of the jni.h file. What is the best way of allowing the Makefile to auto-detect where Java is installed on Linux? Thanks, Chris ...

Can't bring Java window to front when busy

Hi! I have written an image processing application with the GUI part written in Java and the number crunching part is written in C and is called via JNI. My problem is that it takes 20 - 30 seconds for the application to process an image, and during this time the application disappears from the Task Switcher (the Alt-Tab thingy) and it...

Java Queue, Arrays, and JNI

I think this is a general Java question, but it does involve some Android stuff. So here's the deal: I've got a JNI wrapped version of MPG123 for Android, and I can pull PCM data from an MP3 file on the SDCard. I'd like to pull a chunk this data, do an analysis on it using another class I wrote, then push it into a queue. Ideally, I'd...

Windows Mobile Native Code - jstring to LPCTSTR

I have a Java app which needs to interact with the camera on a Windows Mobile device. I have written the Java Code and the Native code and it all works fine. The problem I am having now is that I want to start passing variables from Java to the Native code, e.g. the directory and file name to use for the photo. The native code uses a ...

Get Windows "load average" in Java

I'm currently writing a Java application that needs to look at how "heavily loaded" the machine it's running on is. On *nix, load average divided by number of processors fits the bill perfectly, and we retrieve load average with ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage(). Unfortunately, this returns -1 on Windows...

How can I avoid calling System.load twice?

I have a class that calls a native function to get information about a system from its CMOS. The class has a static initialization block which loads the library containing the native function, and it looks something like this: package lib.sysid; public class SysId { private static native int getSysIdNative(); private static fi...