9,801 questions
6
votes
0
answers
445
views
When should I use name resolution vs. RegisterNatives in JNI?
In System.c, the JVM function corresponding to Java’s System.currentTimeMillis() is registered using RegisterNatives.
In contrast, System.identityHashCode(Object) calls a JVM function directly based ...
972
votes
39
answers
1.6m
views
Failed to load the JNI shared Library (JDK)
When I try opening Eclipse, a pop-up dialog states:
Failed to load the JNI shared library "C:/JDK/bin/client/jvm.dll".
Following this, Eclipse force closes.
Here are a few points I'd like to ...
2
votes
2
answers
402
views
Find out which third party library includes specific native library
I have a very large Android project with hundreds of 3rd party libraries.
Some of those libraries have native .so libs inside then. I can see all .so files using Android Studio -> Analyze Apk... ...
3
votes
3
answers
151
views
How to handle EINTR in connect()?
I'm trying to handle EINTR error from POSIX connect call. I'm running on OSX this connect code:
JNIEXPORT jint JNICALL Java_io_questdb_network_Net_connect
(JNIEnv *e, jclass cl, jint fd, jlong ...
613
votes
14
answers
759k
views
How can I tell if I'm running in 64-bit JVM or 32-bit JVM (from within a program)?
How can I tell if the JVM in which my application runs is 32 bit or 64-bit? Specifically, what functions or properties I can used to detect this within the program?
550
votes
10
answers
266k
views
What is the native keyword in Java for?
While playing this puzzle (It's a Java keyword trivia game), I came across the native keyword.
What is the native keyword in Java used for?
0
votes
0
answers
77
views
How to get information from a QR Code with Unreal Engine Android
I have very little experience with c++ or java and I want to make an Android app with Unreal Engine 5.3, which can either scan or be opened by scanning a QR Code and do something with the Information ...
95
votes
42
answers
1.3m
views
Error "A JNI error has occurred. Please check your installation and try again in Eclipse x86 Windows 8.1"
Consider:
public class LoginCumReg implements ActionListener, KeyListener {
private JFrame form;
private JTextField txtunm;
private JTextField txtnm;
private JTextField txteml;
...
1
vote
0
answers
36
views
How to properly call static method in java from jni [duplicate]
I am trying to pass some initialization values from jni to java.
I have been able locate and correctly call the java method from my JNILib Init function but when I try to call it from a different ...
0
votes
1
answer
129
views
Using JNI library (libnfc) to use PN532 reader in the android application. Cannot build a 32-bit shared library for the purpose of running in Emulator
As mentioned above, I am using the PN532 reader to connect it with the application.
Using the 'libnfc' as JNI library, I built the pn532_uart library as a shared library for 'Arm' based to use the ...
13
votes
2
answers
305
views
Is this a bug in the JVM, or in NASM?
I think I've found a bug, but I'm not sure whether to blame the JVM, JNI, NASM, GCC, or ld.
The bug causes my compiled modding language called grug (see this for videos and explanations) to ...
106
votes
21
answers
477k
views
How to fix an UnsatisfiedLinkError (Can't find dependent libraries) in a JNI project
I'm working on a Java project that uses the JNI. The JNI calls a custom library that I've written myself, let's say mylib.dll, and that depends on a 3rd party library, libsndfile-1.dll.
When I run ...
0
votes
0
answers
36
views
Native Android: How to get an AAsetManager object without a NativeActivity
I want to write a native android library that can access shader and texture files from
the res/raw folder of my application (or rather res/assets?) without being dependent of a specific activity ...
23
votes
4
answers
13k
views
Error:(1, 1) Unable to execute Clang-Tidy: clazy-standalone is not found or cannot be executed in AndroidStudio
In my AndroidStudio project I created native library using JNI with CMake and CPP code. Everything builds and runs OK, but when I try to commit and push my code to git, the CodeAnalysis appears in the ...
0
votes
1
answer
68
views
How do I get a Java field using the Rust jni crate?
I am using the Rust jni crate, and currently have a native method defined. I am trying to figure out how I get a java field, which is a different class that I have also made, and interact with it ...
0
votes
1
answer
165
views
"Unknown option -jar" on running a Rust-Java JNI GTK4 application [closed]
Recently, I have been working on a small gui app that uses GTK4. This gui app uses a combination of Java and Rust (I am using the jni crate for interop).
I am creating the Gui window using the Gtk-rs ...
-1
votes
1
answer
138
views
Using Java FX and C++ together with JNA/JNI [closed]
I'm working on a class project and about half of our group knows c++ and the other half only knows Java FX. Our project is a synthesizer, which involves a good amount of DSP and GUI stuff. I figured ...
0
votes
1
answer
83
views
What does it mean when an Android app has a transactNative DeadObjectException?
My app is a game that consumes a native.so file and has a JNI layer. Whenever the OS kills my app (for example during an in-app update), I see this warning in logcat. What does it mean and how can I ...
96
votes
12
answers
229k
views
how to make jni.h be found?
In Ubuntu 12.04, I have jdk7 from sun/oracle installed. When locate jni.h, it prints multiple locations
/usr/lib/jvm/java-6-openjdk-amd64/include/jni.h
/usr/lib/jvm/jdk1.7.0_07/include/jni.h
...
In ...
0
votes
0
answers
43
views
No implementation found for boolean android.util.Log.isLoggable after JNI_CreateJavaVM
I'm try to exec Log.isLoggable after JNI_CreateJavaVM. Got the error as below with Android 14 and above.
01-02 11:35:15.704 24244 24244 F zygote64: runtime.cc:707] Pending exception java.lang....
0
votes
0
answers
159
views
Android NDK "wrap.sh" and using sanitizers
For some time I am trying to solve a bug in our native C++ shared library using traces but it is not easily reproducable (multithreading/networking involved). We have Android (Java) code instantiating ...
0
votes
1
answer
120
views
JNI Issue: Passing Java Runnable Object to JNI in Custom Gluon Attach Plugin
I am developing a custom Gluon Attach plugin and encountering issues with passing a Java Runnable object from Java to JNI. Despite reviewing the Gluon Attach plugin source code (which unfortunately ...
1
vote
0
answers
68
views
Linux JNI library not finding a symbol in another loaded native library
Running a Java program on a raspberry Pi 5.0 (64bit) under Open-JDK-17. I'm trying to get Bluetooth working (64bit) with the bluecove Java API. One of my shared libs libbluecove_aarch64.so does not ...
1
vote
0
answers
64
views
How do I make jni run a C program?
I have a program in jni (java native interface), which should display the text "hello world" in C
#include "MyJavaClass.h"
#include <jni.h>
#include <stdio.h>
// ...
-1
votes
1
answer
192
views
Cannot load a native JNI library
I'm working on a Minecraft library for my own mods to use and i ran into a problem with JNI.
I'm still new to the JNI and c++ stuff so i might've made a mistake but after hours of searching i didn't ...