jni

JNI invocation api: get method id for method with multiple parameters ...

I want to call java function from c++ which takes multiple parameters , I have tried following statement mid=env->GetMethodID(JDeployerClass,"deploy","(Ljava/io/File;,Lorg/glassfish/api/deployment/DeployCommandParameters;)Ljava/lang/String;"); But its not working out, is there anything wrong with above statement?, What is the correct ...

Creating a QMainWindow from Java using JNI

Hi everybody: I'm trying to create a Qt main windows from Java using JNI directly and I got a threading error. My code looks like this: Test class: public class Test { public static void main(String... args) { System.out.println(System.getProperty("java.library.path")); TestWindow f = new TestWindow(); ...

Install a 32-bit JRE on Windows 64-bit platform

I have a Windows 2008 64-bit server and I have to install a 32-bit JRE, because my Java application uses 32-bit DLLs using JNI. Unfortunately the java.exe is installed to C:\Windows\SysWow64 and when I start a console window or a batch file the installed java.exeis not found. (Because cmd.exe is a 64-bit application and sees the 64-bit ...

Profiling Java running by JNI calls

Hi, I have a C++ code that upon execution: Loads JVM (I have full control on how to load the JVM), and call Java methods (from loaded classes) using C JNI code. The Java code has no Main() and it is actually not a standard Java application. it is mainly a static code that compiled and compacted into Jar file, the code is being called by ...

How to get parameter values in a MethodEntry callback

I have the following java code public class Test { public void sayHello(String msg) { System.out.println(msg); } } new Test().sayHello("Bonjour"); I have a jvmti agent attached to java where I catch function calls. I want to get parameter value which was passed to my method (e.g. "Bonjour") static void JNICALL c...

How to enforce foreign keys using Xerial SQLite JDBC?

According to their release notes, the Xerial SQLite JDBC driver supports foreign keys since version 3.6.20.1. I have tried some time now to get a foreign key constraint to be enforced, but to no avail. Here is what I came up with: public static void main(String[] args) throws ClassNotFoundException, SQLException { Class.forName("...

debugging native code (C++) using gdb on android with Eclipse. Is it possible?

Hi, I have some piece of code which uses JNI. I can debug code wrote in Java directly in Eclipse (using ADT). I even have a script, which help me debug native code with gdb. However this is not very comfortable way for doing this. Is it possible to configure Eclipse to use gdb (I guess gdbserver) for debbuging android native applicatio...

Calling a Java API from .NET - best approach

I need to call an API that's all in java from an existing .NET codebase. What's the best approach here? Writing a webservice in java that basically just forwards the calls to the API - or going with something like JNI4NET? ...

Working with libpath with java reflection.

I'm dynamically loading a class and calling a method on it. This class does JNI. When I call the class, java attempts to load the library. This causes an error because the library is not on the libpath. I'm calling from instead a jar so I can't easily change the libpath (especially since the library is not in the same directory or a ...

Recommend me a good JNI book

Hello, I'm creating a software project in Java, is a remote administration tool. The thing is that I need to add some features with C++ and I read some about this process and I realized I need JNI, could you recommend me a good JNI Book or something related with ? ...

How to bundle a native library and a JNI library inside a JAR?

The library in question is Tokyo Cabinet. I want is to have the native library, JNI library, and all Java API classes in one JAR file to avoid redistribution headaches. There seems to be an attempt at this at GitHub, but It does not include the actual native library, only JNI library. It seems to be specific to Leiningen's native dep...

get active window of other programs using java

i am trying to make java application that can get the information from other active window program ...such as information bar or even screenshot of other active window is JNI the only option in this case? thanks ...

JNI_CreateJavaVM: Buffer overrun if I throw an exception in case of failure

Hi, In a C++ project, I use the JNI invocation API to launch a JVM. I've done a little wrapper arount the JVM so I can use all the needed parts in a OO fashion. So far that works great. Now, if the JVM does not start (JNI_CreateJavaVM returns a value < 0) I'd like to raise an exception within my C++ code.But if I throw an exception aft...

JNI Invocation api using shared objects loaded natively.

Guys, I have a huge problem. I need to start the JVM from the Invocation API (JNI) but I need to use a library that is loaded on the native side (not from JNI neither from Java(. Imagine the following scenario I load a bunch of libraries that support some JVM functions before starting JVM itself, and after that I start the JVM. So how ca...

Building OpenSSL on Android NDK

Hi, I want to use DTLS (on OpenSSL) using JNI on Android 2.1/2.2. Can someone help me get started (tutorials, howto, pointers etc) with building OpenSSL for Android (2.1/2.2) using the Android NDK? Anything important that I should be aware of before doing it. Thanks. ...

How to load a library that depends on another library, all from a jar file

I would like to ship my application as a self-contained jar file. The jar file should contain all the class files, as well as two shared libraries. One of these shared libraries is written for the JNI and is essentially an indirection to the other one (which is 100% C). I have first tried running my jar file without the libraries, but h...

How to unload JVM from a living process?

Hi, I'm working with JNI and trying to unload (destroy) the VM using DestoryJavaVM function (I first call DetachCurrentThread method). It seems like the it has now influence on the VM and it is still up after the call. I read in old Sun posts that DestoryJavaVM had problems in the past (JDK1.1-1.3 in 2001) but I'm using JRE 6 and it pro...

Text passing C -> Java Using JNI

Hello, I would like to know and get an implementation help, if possible, about the best way to transfer very large amount to pure text from C to Java using JNI. ...jst want to add that I tried to put all text in one string, but at some point when the file reaches 140mb a kernell32.dll error(outside of JVM) occurs. I want to get as hish...

Java Input/Output streams for unnamed pipes created in native code?

Is there a way to easily create Java Input/Output streams for unnamed pipes created in native code? Motivation: I need my own implementation of the Process class. The native code spawns me a new process with subprocess' IO streams redirected to unnamed pipes. Problem: The file descriptors for correct ends of those pipes make their way ...

Using a java class from Delphi

I need to use the logic contained in some java classes. I found JNI, but that project seems not updated recently. Is there a way to use it in a Delphi native application? I use Delphi 2009. ...