jni

How to send signal to JVM created by JNI_CreateJavavm call?

Hello Guys Is there any possibility that I can directly send signal to a Java virtual machine which is created by calling JVM_CreateJavavm in native C/C++ code? e.g.: For a normal Java process, say its pid is 12345, I can send a signal 3 to it like this ... kill -3 12345, and hopefully I could trigger javacore or heapdump by changing...

Cant set java class object by JNI in android

I have trouble setting java object value in JNI. When run under debug mode, it always show this error: DalvikVM[localhost:8664] - Thread[,#.main] (suspended(exception RuntimeException)) I don't know what's wrong with it. Can someone please help me out here. Many thanks in advance. Below are my code: [Data class] package com.li...

Is it possible to debug core dumps when using Java JNI?

My application is mostly Java but, for certain calculations, uses a C++ library. Our environment is Java 1.6 running on RedHat 3 (soon to be RedHat 5). My problem is that the C++ library is not thread-safe. To work around this, we run multiple, single-threaded "worker" processes and give them work to do from a central Work Manager, also...

JNI Invocation API - NoClassDefFoundError (C/Java)

I am trying to get my feet wet with JNI because I have an application in C that needs to access a single Java library function (no C-equivalent library). I've written a very simple test program to load a Java VM from C and call a static function and get the return value. Unfortunately, I am unable to get the class to properly load. Al...

Does ntdll.dll come standard with windows xp and windows vista?

Hello, Does ntdll.dll come standard with windows xp and windows vista? I know that I have it on my windows xp machine, but am not sure that is standard with every machine. The reason I am curious is for the NTQuerySystemInformation function to get CPU usage of a windows xp and/or windows vista system. Thanks, Steve ...

Android NDK: Autogenerate function declarations?

I am trying to use a pre-existing native C library in my android project.. The library builds just fine with the NDK tools... Now what I've come to understand is that I cannot just call into the library, but my library needs to include jni.h and add specific function declarations, like for example: JNIEXPORT jint JNICALL Java_com_MultP...

Android - How to enable CheckJni for NDK development?

Hi. Can someone please tell me if I'm missing something here? I am trying the following commands in shell. $ ./adb shell stop $ ./adb shell setprop dalvik.vm.checkjni true $ ./adb shell start But Logcat always shows "CheckJNI is OFF" when I install the apk onto the device.. Is there something else in eclipse that I need to do to enabl...

Calling Java library from Objective C on Mac

Hi guys, I want to create native Mac OS X application using Cocoa + Objective C but I need to connect to proprietary data source, and for this, owner of the data source only provides Java library. So I need to somehow import this Java library into my project and call functions on its Java classes.(Or create java wrapper around this libra...

Pinning a Java application to the Windows 7 taskbar

Original question I use Launch4j as a wrapper for my Java application under Windows 7, which, to my understanding, in essence forks an instance of javaw.exe that in turn interprets the Java code. As a result, when attempting to pin my application to the task bar, Windows instead pins javaw.exe. Without the required command line, my appl...

Bundling native dll with jar

Hi, I need to include native lib (jnotify but I think that it does't matter) to my jar. I wont to do it with NetBeans. I added Bundle-NativeCode: /lib/jnotify.dll; osname=win32 to my manifest.mf file and added jnotify.dll to projektHome\src\lib\ folder. But unfortunately NetBeans is overidning manifest.mf file. How can I fixed? Can I ...

JNI / C library: passing byte ptr

I have an unsigned char* in my C library, and Im calling a JNI exported function that needs to set a java object with this data... preferably in a byte[]. But this function will be called very often, and it's quite a lot of data to be copied.. Is it possible to use a ByteBuffer and assign the pointer of that bytebuffer to my unsigned ch...

Cocoa class launched from JNI

I currently have code that makes a call from java into my cocoa app using JNI, in the JNI function on the cocoa side I create a new thread and assign my NSApp delegate like the main function would do. Here is the code I am using in a dummy class that creates my real class: @implementation MenuLauncher - (void)run { NSAutoreleasePo...

JNI: NoSuchFieldError

Output of: javap -s SomeClass public org.someapp.SomeClass$_data data; Signature: Lorg/someapp/SomeClass$_data; Definition of SomeClass in Java: class SomeClass { private class _data { byte[] something = new byte[1234]; } public _data data; } Definition of native function in Java: public static native int Na...

JODConverter 3.0, OpenOffice, and JNI

I'm using JODConverter 3.0 to handle communicating with OpenOffice to convert documents. Everything is working fine except that JODConverter uses a Java library from OpenOffice that uses JNI to grab certain library files from the system. This throws an exception if I don't set the java.library.path method using -D when running java. The...

JNI problem on OSX

I'm running into problems using AWT classes on OSX (10.5.8) with Java 6 (1.6.0_17 JVM: 14.3-b01-101). Trying to load java.awt.Dimension the code just freezes, this happens in Eclipse or from the command line. Anyone experiencing same problems ? The class is used by JAI in the following code: public static byte[] resizeAsJPG(byte[] imag...

Glassfish native library loading (.dll, .so)

I am using the recently released Glassfish v3 and while using native libraries glassfish would intermittently complain glassfish SEVERE: java.lang.UnsatisfiedLinkError: Native Library already loaded in another classloader The procedure to load native libraries in the previous glassfish release (v2.2) was to simply put the .dll files in...

Mutex in JNI using Foundation NSLock

I have some objective-c code that uses an NSLock to implement a sort of transaction. The object is locked on a "begin transaction", several other calls are made with the lock in place, and then it's released with a "commit". I'm writing a JNI glue layer to access this code from Java, but the lock is behaving differently in JNI vs pure ...

JNI Java in c++

Hello I am trying to create Java Virtual Machine in a cplusplus program using the code as follows: JNIEnv *env; JavaVMInitArgs vm_args; JavaVMOption options[1]; options[0].optionString = "-Djava.class.path=D:\\Java Src\\TestStruct"; //Path to the java source code vm_args.version = JNI_VERSION_1_6; //JDK version. This indicates version ...

Access a 16 Bit DLL.

I have been given the task to upgrade an existing 16 Bit Desktop application originally written in GFA Basic. I want to know if there is a possibility to access the functions inside these 16 Bit Dlls via C/JNI (or any other programming language). I guess, I have to write some sort of an intermediate DLL to access the functionalities from...

Do I Have to JNI Detach an Attached Thread?

I have some native thread that needs to call into Java. For that, I need to attach the thread to the VM using AttachCurrentThread. Since this callback will happen quite often, the thread should probably stay attached. Calling AttachCurrentThread multiple times is fine ("Trying to attach a thread that is already attached is a no-op.") ...