I'm writing a test engine for a Java application that has some of the code written in C. This application uses JNI to access it's native part.
In the engine I'm writing, I use Fest to control de UI and perform the tests. However, I,m blind when dealing with the part that is written in C. I wonder if I can use JNA or JNI to access the n...
Hi,
A java swing application(GUI) using JNI code to communicate with native C code. The Swing application launches properly and works fine.
The GUI is used to start some customized system level tests(io,memory,cpu) and show their progress. The tests have to be left running at-least overnight to get the
results. But, the next morning,...
I have a program that's using the FFMPEG binary libraries via JNI. There is a call to open a URL which is blocking in native code, and I need to allow the user to manually cancel this connection. Sometimes Thread.interrupt() works just like it's supposed to (if the url I'm connecting to is "udp://{whatever}"). If my URL is "rtp://{wha...
When calling the GetFieldID method through the JNI environment variable, you are required to provide a Field Descriptor for the desired field. How do you find what the Field Descriptor for an object is?
Example:
jfieldID strField = env->GetFieldID(myClass, "example", "Ljava/lang/String;");
How would I determine that "Ljava/lang/Strin...
I have an a.dll (not modifiable as i do not have the source) with a function bool openPort(DWORD mem).I wrote a c++ main, loaded this dll using LoadLibrary, and the function works well.It returns true.
Now, I need to call this function from Java via JNI.
I wrote another b.dll with a function like so
JNIEXPORT void JNICALL Java_MyClass_...
How do I import a dll into my dll project in Eclipse Ganymede?
I am creating a dll for JNI.
I included the .h of the dll but I keep getting errors about the function not referenced...
Please help.
Thanks.
...
I am creating a Java application that controls a Controller Area Network (CAN) controller via a vendor-supplied can.dll file.
can.dll contains a function bool openPort(DWORD memAddr) that allows the application to establish connection with the CAN controller.
I wrote a C++ test application, loaded can.dll via LoadLibrary and found this...
Hello,
I am testing some custom JNI code on a remote Linux based system. I don't want to have to install DBX and JDB isn't being entirely helpful and diagnosing the issue. Is there any other light weight java JNI debugger that will actually show me where within the JNI code Im going wrong?
Thanks
...
Hello,
Having a peculiar problem. When I call the following JNI method.
jobjectArray array = env->NewObjectArray(list->size, jclass, 0);
Now, list->size is set to 54. But as soon as the code above is run the same pointer returns, 2405015736 whats going on? As affects the values held in the rest of the struct also. Setting a static va...
Must all the methods that are native be also static??
...
I have a c++ layer that talks to a db, this c++ layer does a new SomeObject() and returns it to java.
When is it safe for me to say delete SomeObject via my clean jni call. Can I delete as soon as java has the returned object or do I need to copy the object and then delete?
...
Hello
I'm responsible for maintaining a java swing application. It used to run quite fine with java 1.4, but with the time we encountered more and more crashes of the JRE that made us upgrade to the JRE 1.6, which at least is still maintained by Sun.
With the JRE 1.6 we now encounter a different kind of problem, in the part displaying ...
Hello,
I have been looking at Android's javax.net.ssl package, but am still confused as to how it works with the underlying JNI glue in place.
From what I see, all of the classes under the javax.net.ssl package (/libcore/x-net/src/main/java/javax/net/ssl) are abstract and do not directly implement functionality.
All of the functiona...
I've seen some questions on how to properly pass a C array into Java using JNI, but I have the reverse problem:
How do I properly call an int array getter method in C using JNI. Specifically, I want to pass a BufferedImage instance into C and call the "public int[] getRGB()" method on this BufferedImage instance.
My understanding is th...
I need to write a dynamic link library in C++ that is used by Java on Android.
As I get, it should be .so library, but I don't know how to do that.
I tried Cygwin, but it crashes:
$ gcc 1.cpp
/usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: cannot find -luser32 collect2: ld
returned 1 exit status
1.cpp:
...
How to get file name from active text editor using User32 JNI?
example: I'm editing text in some text editor (win32) and I have another java app that needs to know file name (file path) of file that I'm currently editing text in.
...
I have a java class (eval.java) that invokes a native method in an so file (libmodel.so). I can use System.loadLibrary() to load the libmodel.so without any error (-Djava.library.path=/usr/lib), and the native method initModel() works fine.
However, when I deploy it as a web service (tomcat 6.0.26 + axis2 1.5.1 + eclipse jee helios) to ...
.Net assembly PE Header has a target platform for 32-bit / 64-bit which is used when the assembly use native interop like p/invoke (other wise it would be Target=AnyCPU)
Is there any equivalent for Java when the Java application has an interface to some native interface through JNI? The JNI has to be either compiled for 32 or 64 bit
I...
I have made a Java Applet that depends on some third party libriaries as well as a DLL that is called via JNI. These will obviously not be installed on clients computers. Is there anyway to package these third party libriaries and external DLLs within my Applet's JAR so that it can be run by any client with a base Java install?
...
According to JNI docs, GetStringCritical() disable garbage collection while you hold on to some memory managed by the JVM. Using this instead of GetString() puts your native at risks of deadlock if you call into the Java layer or perform blocking operation before ReleaseStringCritical() is invoked. So what's the benefit of the Critical f...