1
голосов
1ответов
312 просмотров

Loading a universal binary with Java

I have an Java applet that loads native code through JNI. Everything worked just fine until I made the upgrade to Snow Leopard, and then Safari decided to be dumb. It turns out Safari will only load 64 bit binaries when in 64 bit mode. (You can put it in 32 bit mode, but that is not an option.) I...

1
голосов
1ответов
1376 просмотров

Writing to std out from Java JNI DLL - output only appear when application exits

We're writing a JNI DLL to wrap a third-party DLL. In our DLL, we're writing debug statements to standard out. When we use the DLL from our Java application, nothing gets printed to the Java console during the application execution. When the application is closed, all the output from the DLL get...

3
голосов
2ответов
4219 просмотров

Passing large C structure through JNI efficiently

I have a large C structure (about 40 members, int and char[]) which I have to pass through JNI to the Java side for further processing. This happens repeatedly. (I already put the GetMethodID() etc. into an init() function on the C side so I only have to call them once.) What would be an efficie...

2
голосов
3ответов
3410 просмотров

JNI Performance

Our main program is in java but the code that extracts our data from storage is written in C. I need to build an HDF5 file from extracted data. Would it be better to use JNI to call the C code to get the data and then build the HDF5 file from Java or to build the HDF5 from the C code? I have li...

14
голосов
3ответов
10050 просмотров

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. ...

115
голосов
10ответов
48533 просмотров

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?

3
голосов
2ответов
2022 просмотров

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 compa...

0
голосов
1ответов
1747 просмотров

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

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

3
голосов
4ответов
8648 просмотров

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...

8
голосов
2ответов
12137 просмотров

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...

4
голосов
2ответов
8590 просмотров

JNI Pass By Reference, Is it Possible?

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 native method would look something like...

4
голосов
3ответов
3507 просмотров

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...

1
голосов
8ответов
1358 просмотров

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.

1
голосов
2ответов
998 просмотров

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 SWIG...

0
голосов
2ответов
1310 просмотров

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...

2
голосов
1ответов
8079 просмотров

java.lang.UnsatisfiedLinkError in my java program :(

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 j...

2
голосов
1ответов
6110 просмотров

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 cor...

1
голосов
1ответов
1541 просмотров

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 retu...

3
голосов
1ответов
4642 просмотров

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.

1
голосов
2ответов
3160 просмотров

JNI segmentation fault bug

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...

15
голосов
3ответов
4863 просмотров

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...

8
голосов
3ответов
4059 просмотров

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.

1
голосов
4ответов
956 просмотров

Invoking Apache-FOP from C++

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

3
голосов
5ответов
609 просмотров

J++ to Java: how to migrate from RNI to JNI?

I've inherited a legacy J++ project. I've upgraded this project to standard Sun Java successfully. However, this project includes a native C++ dll which the Java code talks to via the Microsoft-specific RNI framework. Needless to say, calling System.loadLibrary("myRniNativeDll") now throws a Un...

92
голосов
13ответов
353701 просмотров

java.lang.UnsatisfiedLinkError no *****.dll in java.library.path

How can I load a custom dll file in my web application? I've tried the following: Copied all required dlls in system32 folder and tried to load one of them in Servlet constructor System.loadLibrary Copied required dlls into tomcat_home/shared/lib and tomcat_home/common/lib All these dlls are in...

9
голосов
6ответов
5278 просмотров

Disadvantages of using Java Native Interface

I can not get these two disadvantages of using JNI. I want to know more about them: Difficult to debug runtime error in native code Errors in JNI code take down the entire JVM and don't provide any mechanism for graceful recovery

4
голосов
1ответов
2262 просмотров

callbacks in jni

Is there any way to pass a callback to java code, from C. And the call returns immediately. Later on, after completing the task, the java code can invoke that callback. I have a C extension for php that calls a java store to store some items in it. The items can be retrieved from store in synch...

2
голосов
1ответов
4634 просмотров

How to fix Java JNI DLL dependencies

I have a Java Application which has to load an DLL with a few dependencies. I copied all required DLLs in the same folder. The DLL I was set up uses the SeeingMachine FaceApi libraries. Now when I'm starting the Java application I will get an error the my DLL can't find the dependencies: Except...

12
голосов
5ответов
47202 просмотров

JNI Hello World Unsatisfied Link Error

This is my first attempt at JNI. My ultimate goal is to get all tasks currently running on a machine, but need to get even a simple example running. I keep getting this error when I try to execute my main program. I have supplied my simple Java main program, the header file generated, and the err...

0
голосов
3ответов
939 просмотров

Java LoadLibrary UnsatisfiedLinkError, though Java can see the file and runs on another computer

This problem is really befuddling me and hopefully someone could help me out. I've written some plugin libraries for a large java software. Everything works fine and well on my development computer. However, after I compiled and wrapped the software in Nullsoft Installer and install onto another ...