jni

Complete Way to Compile Complex Native Applications to Android ARM

Hello! This is my first S/O question, please be gentle! I'd like to know more about porting C applications to native ARM for use on Android devices. I can make simple programs using the prebuild toolchain which comes with the source, but how can I use this toolchain with applications which are more than one file and require configure a...

JNI Calls different in C vs C++?

Hey Folks, So i have the following code in C that utilizes Java Native Interface however i would like to convert this to C++ but am not sure how. #include <jni.h> #include <stdio.h> #include "InstanceMethodCall.h" JNIEXPORT void JNICALL Java_InstanceMethodCall_nativeMethod(JNIEnv *env, jobject obj) { jclass cls = (*env)->G...

eclipse plugin not loading dll due to long path

I am building an eclipse plugin (a notes plugin, but its a eclipse plugin in the end). One of the plugins my plugin depends on needs to load a native dll. The problem is, that fails depending on where in the disk such dll is. If it is longer than a certain threshold I get the error below java.lang.UnsatisfiedLinkError: nlsxbe (The file...

Method Calls in C++ with JNI?

Hey Folks, So i have been looking into JNI calls so i can interact with some pre written C++ programs, i dont know any C++ but am trying to learn some basics. I have just been trying to do a simple call to a method outside my JNI method but always get the following error: error c3861 'myMethod': identifier not found #include <stdio.h>...

C/C++ Reflection and JNI - A method for invoking native code which hasn't been written yet .. feel free to tell me I'm an idiot

Hi All, I am implementing a piece of Java software that will hopefully allow for C libraries as plugins. In order to call these future functions I need to somehow create a native function in Java from which I can call the code that doesn't exist yet. The method signature will be static but the method and class names may change. I am ...

Enable C application as Webservice

We have an application written in C language which interacts with Oracle database. This application is an executable and runs on unix platform. We need to expose this application over http as web service for others to consume. I thought of using JNI and CXF for webservice and run the application in tomcat. Is this a right solution or t...

Javah error while using it in JNI?

javah -jni JavaHowTo error: cannot access JavaHowTo class file for JavaHowTo not found javadoc: error - Class JavaHowTo not found. Error: No classes were specified on the command line. Try -help. Hi guys, i have set the class path correctly. But still i am getting this javah error. Any solution for this will be much helpful. ...

JNI Call to Authenticate user using LogonUser?

Hey Folks, C++ noob here wonding how i can authenticate a Windows User via Java servlet. Here is the code i have put together to take in a JNI call from my java servlet with the user's username domain and password: #include <stdio.h> #include <string.h> #include <sys/stat.h> #include <stdlib.h> #include "Validate.h" JNIEXPORT j...

What is the easiest way to call a Windows kernel function from Java?

While searching for how to do this, I found some vague discussion about different options, like JNI vs JNA, but not much in the way of concrete examples. Context: if Java's File.renameTo() cannot do it's job (for whatever reason; it is a little problematic), I'd like to fall back to directly using this native Windows function, which is ...

Managing DLL dependencies with Maven

I have a Java program with Maven managing its dependencies. One of those dependency is a JNI wrapper for another program. Maven takes care of the reference to the relevant JAR file, but I'm left messing around with the DLL file myself. Is there a good way of having Maven handle the DLL as well? Ideally I would like to have the DLL load...

How do I get a list of JNI libraries which are loaded?

Just what the subject says, is there a way in Java to get a list of all the JNI native libraries which have been loaded at any given time? ...

How to debug a java system.loadlibrary error in linux?

I have a Java program that is calling C code through JNI that I'm attempting to run on Linux. The external code consists of two .so files: one for the JNI bindings (built with swig) and the other with the actual functions. I have the two libraries in the same directory and LD_LIBRARY_PATH is set correctly. ldd reports no problems when...

What does the registerNatives() method do?

In java, what does the private static method registerNatives() of the Object class do? ...

Force Java to call my C++ destructor (JNI)

I thought this question would have been asked before, but I couldn't find it here... I've used SWIG to create a JNI wrapper around a C++ class. All works great except that Java never seems to call the class's finalize(), so, in turn, my class's destructor never gets called. The class's destructor does some final file I/O, so unfortunate...

Any suggestion on how to improve the performance of a Java String to byte[] conversion?

I've inherited a piece of code that makes intensive use of String -> byte[] conversions and vice versa for some homegrown serialisation code. Essentially the Java objects know how to convert their constituent parts into Strings which then get converted into a byte[]. Said byte array is then passed through JNI into C++ code that reconstit...

java, System.loadlibrary("someDLLFile") gets unstatisfied link error

Hello, I have written some JNI hooks into a C++ library and created some DLL files for my java server project. Lets say the DLL and jar files are in the same folder under "C:/server" I am accessing these DLL files using: System.loadLibrary("someDLLFile"); in the class that needs the C++ code. The problem I am running into is when I...

.dll already loaded in another classloader?

I have a webapp running under Tomcat 3.2.1 that needs to make JNI calls in order to access data and methods in legacy C++ code. A servlet is loaded on startup of the webapp that, as part if its init method, causes a data set specific to that webapp instance to be loaded into the C++ data structures. This Java code for this s...

Java bean with JNI ?

I have added native method in java bean code. Then i have copied .dll file in System32 folder. while using javabean in JSP. it gives an Error: HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperE...

g++ symbol versioning. Set it to GCC_3.0 using version 4 of g++

Hi all I need to implemente a Java class which uses JNI to control a fiscal printer in XUbuntu 8.10 with sun-java6-jdk installed. The structure is the following: EpsonDriver.java loads libEpson.so libEpson is linked dynamically with EpsonFiscalProtocol.so ( provided by Epson, no source available ) and pthread I use javah to generate...

How to check whether .dll is loading again?

Hi, i used .dll in JSP. In a first Jsp program i did a code to forward another JSP page. which again uses the same dll So my question is does that forwarded page again loads the library? Or it loaded once? i code System.loadlibrary("lib") in a separate class and created a object for that class in first JSP page and also in th...