jni

What is xdoclet? (from a C-programmer point of view)

Question from a C-guy who has to work with some java code that is connected to my C-code via JNI. I have to work on the build-system, and I'm trying to change that from a shell-script to a proper makefile. For the C-part that's easy, but the java side somehow involves xdoclet stuff. I haven't yet found out what xdoclet is all about, a...

Bash script to create symbolic links to shared libraries

I think this question is rather easy for you shell scripting monsters. I am looking for the most elegant and shortest way to create symbolic links to shared libraries for Unix by means of a bash shell script. What I need is starting out with a list of shared library files such as "libmythings.so.1.1, libotherthings.so.5.11", get the sy...

As a Java developer, C or C++?

I've been writing Java professionally for the last 5 years. Recently, I've had to dig into JNI a bit to call some Windows specific functions. This experience has highlighted my poor command of the C (or C++ for that matter) language. My only introduction to C was a brief "dummies" book that I read in high school 11 years ago. I know ...

Invoking via command line versus JNI

I need to invoke tesseract OCR (its an open source library in C++ that does Optical Character Recognition) from a Java Application Server. Right now its easy enough to run the executable using Runtime.exec(). The basic logic would be Save image that is currently held in memory to file (a .tif) pass in the image file name to the tessera...

Byte stream / C / JNI

What data types are usually used in C API implementation for storing byte streams? How can I convert this type to jbyteArray? ...

Passing pointer from java to native

Hi. Im making an inerface to a DLL library, so i can use it with Java. I need my native function to modify the value of a jlong parameter. Like the parameter was passed by reference. My Java method must have the exact parameters as the native function MPUSBWrite shown down here. Example of actual not working code: The MPUSBWrite gets it...

How can I load the AIR runtime as a in-process shared library from a C program

I'd like to build a special AIR launcher program in C along the lines of java.exe. I've looked at running AIR programs with a process viewer and was able to locate the AIR runtime DLL that is being used. AIR programs are different than Java in that they are installed as platform-specific executables that bind the AIR runtime as an in-pr...

Performance / stability of a Memory Mapped file - Native or MappedByteBuffer - vs. plain ol' FileOutputStream

I support a legacy Java application that uses flat files (plain text) for persistence. Due to the nature of the application, the size of these files can reach 100s MB per day, and often the limiting factor in application performance is file IO. Currently, the application uses a plain ol' java.io.FileOutputStream to write data to disk. ...

java.lang.UnsatisfiedLinkError in Linux.

Hello. I've managed to get into a linux machine to try the HotKey library suggested in this answer. I've compiled the sample code and now I run the program and I've got the following message: [oracle@machine jxgrabkey-0.2.1_i386]$ java -classpath lib/JXGrabKey.jar:Example JXGrabKeyTest Exception in thread "main" **java.lang.Unsatis...

How do I interpret this JVM fault?

I have a Java app that makes use of some native code, and it's faulting. I want to find out where it's faulting, but I'm not sure how to read the hs_err_pid dump file: Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x256cbc] V [libjvm.so+0x25df69] V [libjvm.so+0x25dbac] V [libjvm.so+0x2...

Rewrite C code in Java or use JNI?

I'm currently developing on a project written in Java. We have a bunch of algorithms written in C/C++ (at least a couple hundred) that need to be incorporated in our project. Our two options are to use JNI to call this code, or to rewrite all the algorithms in Java. I am aware of the consequences of using JNI, it can open up a whole n...

Java Drag and Drop to native os

I've been looking around for some time and have yet to be able to find any libraries or information for Java on how to drag lets say an ImageIcon onto a Windows folder and get the path as to where you "dropped" the ImageIcon. I'd really like a platform independent solution that works across OSX/linux/Win, but at the very least would like...

How to notify the user of important events for a desktop application?

Our customer is using our software (Java Swing application started using Webstart) besides other software like MS Office, to do his job. From time to time there are important events he has to deal with in our software without much delay. The customer wants to have a prominent notification then. Now he might be using Excel at the moment, ...

Simple code to handle JNI exceptions

I'd like to have a nice, tidy way of expressing the following java code as JNI: try { SomeMethod (); } catch (ExceptionType1 e) { SomeAction (); } catch (ExceptionType2 e) { SomeAction (); } catch (ExceptionType3 e) { SomeAction (); } Is there a tidy JNI patter for doing this? At present, I have this: java_class = (*...

Dynamically loading a native library inside Java applet

I am trying to write a Java applet that will read from a user's serial port. For this I am using the Java Comm API in conjuction with the RXTX library. I've successfully managed to read data through a local Java application but I can't seem to do the same from within an applet. The problem is that the RXTX library is a native library and...

Where does java stderr go?

Hi, I would like to know, where does java stderr standardly go? I know I can change the stderr using System.setErr, which 'Reassigns the "standard" error output stream.', but I dont know, which one is "standard". I would like to specify my question more: I have C++ library that I use in java (jni). The problem is that it appears that ...

How do I integrate JNI code into weblogic?

Hello Overflowers. I am writing an application which will be deployed in weblogic. As part of this application, we are using a third party library which uses JNI. How do I make the .so file available to weblogic? I tried setting the LD_LIBRARY_PATH and restarting weblogic with no luck ...

Which is the fastest way to access native code from Java?

Which is the fastest way of calling a native library from Java? The ones I know about are NativeCall - what we're currently using JNA - haven't used it, but looks reasonable JNI - looks horrendous to write, but we'll do it if we get the speed ...

JNI signatures for nested classes?

Hi all, I'm trying to use JNI on WindowsXP, java version: java version "1.6.0_13" Java(TM) SE Runtime Environment (build 1.6.0_13-b03) Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing) When trying to get jclass for a nested class jclass c = env->FindClass ("A$B"); assert (c); the second line asserts, The same thing wo...

How to start Java from within a C process?

I want to add some Java (actually Clojure) based event handlers to a HUGE legacy C application. What is the most straight forward and easily maintained way to do this? I would like the Java classes to be running in the same process as the C code. Is this even possible? ...