jni

Invoking Apache-FOP from C++

Hi, Has anyone experience or had problems implementing a JNI wrapper for apache FOP? Bonus points: Any other options for processing xsl-fo from C++? ...

How to reverse System.loadLibrary in Java

I am writing a JNI program and I want to unload the dll after i hava finished using it. What can I do for this purpose? I couldn't find a unloadLibrary() method in the Javadoc. ...

Sharing output streams through a JNI interface

I am writing a Java application that uses a C++ library through a JNI interface. The C++ library creates objects of type Foo, which are duly passed up through JNI to Java. Suppose the library has an output function void Foo::print(std::ostream &os) and I have a Java OutputStream out. How can I invoke Foo::print from Java so that...

JNI program hanging

In one of my Java projects I am expected to call a C function. As I am new to JNI, I first attempted a simple Helloworld program. I wrote a class with a reference to a native method by name sayHello() which returns void and takes no argument. I compiled the class and generated the header file using the javah utility. I then copied over ...

JNI segmentation fault bug

Hi, there is this morphological analyzer (open source, written in OCml) named ocamorph. download and make instructions here The java binding is buggy and I'll have to fix it and after a few hours of struggle now it seems to me it'll take a few days to fix it as I'm not familiar with C, JNI, OCml and this particular software. Here you c...

How to unload a dll which gets loaded by System.load(path to dll)

Is there any way to unload a DLL which gets loaded in the application using System.load() API call. ...

Unable to create JVM using jni_CreateJavaVM API in Fedora 8

I have created a PHP extension (written in C). I am using JNI to make java calls. I use jni_CreateJavaVM to create JVM. This works fine in: IIS (windows) Apache (windows) PHP CLI (Fedora 8) But when I try to load the same extension from Apache (in Fedore 8), the create jni_ CreateJavaVM return JNI _ERROR. I call jni _CreateJavaVM fr...

Converting a .so file to a .jnilib file

I've got a .so library compiled for Linux under the ELF format, which is being used by a Java program. I'm trying to port this application to Mac OS X, and have discovered that OS X uses a different extension for these files, .jnilib. I've already figured out how to set up the PATH so that it correctly finds the files. However, OS X Java...

java.lang.UnsatisfiedLinkError in my java program :(

Hi, I created a program which uses JNI. I compiled it, generated header file, created a corresponding C program, and created dll for it. I am running into an exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\examples\FirstJNIExample.dll: Can't find dependent libraries at java.lang.ClassLoader$NativeLibrary.l...

JNI error on Mac OS X 10.4.11... dyld: Symbol not found: _objc_setProperty

I have a problem with some JNI code. I'm getting the following error printed in the console from a OS X 10.4.11 (PPC) machine (it works fine on newer versions of OS X 10.5+) dyld: lazy symbol binding failed: Symbol not found: _objc_setProperty Referenced from: /Path/to/my/lib/libMylib32.jnilib Expected in: /usr/lib/libobjc.A.dylib ...

Java and SDL_GetKeyState()

I'm trying to convert to Java some code that uses SDL. I'm using the sdljava bindings. sdljava uses SWIG as the bridge between the C datatypes and Java. To get the equivalent of SDL_GetKeyState(), sdljava provides the method SWIG_SDLEvent.SDL_GetKeyState(), which returns something called a SWIGTYPE_p_unsigned_char. Of course, Java has...

Profile CPU usage in Java on a Mac

I'm looking for a way to measure the cpu usage for different methods in my java code. I understand that this can be achieved using JNI and C, but I wouldn't know where to start... The purpose of this is to compare different algorithms, and provide qualitative results. ...

SWIG pointers and Java arrays

The SWIG documentation explains how a variety of input types in C, like this: void spam1(Foo *x); // Pass by pointer void spam2(Foo &x); // Pass by reference void spam3(Foo x); // Pass by value void spam4(Foo x[]); // Array of objects ... would all take a single type of argument in Java, like this: Foo f = new Foo...

JNI Pass By Reference, Is it Possible?

Hey, I have a Java program that calls a C++ program to authenticate users. I would like the program to return either true or false, and if false, update a pointer to an error message variable that i then can grab from the Java program. Another explination: The nataive method would look something like this: public native String takeIn...

JNI Freeing Memory to Avoid Memory Leak

So i have this C++ program that is called via JNI from my Java program, the code follows: JNIEXPORT jstring JNICALL Java_com_entrust_adminservices_urs_examples_authn_LdapAuthenticator2_takeInfo(JNIEnv *env, jobject obj, jstring domain, jstring id, jstring idca, jstring password) { const char *nt_domain; const char *nt_id; ...

Android - JNI guidelines

I want to incorporate small, lean and mean C-based parser into my Android project. I've done JNI programming in the past but not any type of native (C) development on Android. My plan is to compile C lib into SO and create JNI wrapper around it which I'm going to use in my app. Is this how it can/should be done? Second and most important...

FOR JNI experts, How Would I use JNI to call ReadProcessMemory? (Read memory from windows applications)

Hey there, I would like to know if theres a possibility to call C++ methods from java. Pretty much I want to be able to read memory processes from java. I know c++, but I Would like to use a higher lvl like java, but still be able to hack into processes memory. Any clues? []'s ...

Execute native code via JNI/DLL or EXE?

We have a native app that we can access via JNI->DLL or by invoking an EXE with command line parameters. Which would be the best approach? We will be invoking this method about 100 times a day. Performance isn't super important. This native app was developed by a group outside of our company so we are not too familiar with the code (...

Use JNI instead of JNA to call native code?

JNA seems a fair bit easier to use to call native code compared to JNI. In what cases would you use JNI over JNA? ...

Defaults for Eclipse run configurations

I'm writing a Java library with a lot of jni code. Pretty much every test case needs to load my jni dll, and I have a lot of test cases. In order to run the test cases out of Eclipse's Junit launcher, I have to create a run/debug configuration and edit the VM arguments and environment variables. I would like a way to set the VM argument...