Questions tagged [jni]
The Java Native Interface (JNI) gives both the ability for JVM implementations to run system native code, and the ability for native code to run Java code (by creating new JVM instances). The most common target languages for JNI are C and C++, for which at least the Sun/Oracle JDK implementations provide helper commands (javap, javah).
11 questions
4
votes
2
answers
330
views
Multithreaded Conway's Game of Life implementation written in C and Java using JNI
I had some multithreading C programming experience from school last year but I wanted a bit more so I tried to program a Conway's Game of Life implementation from scratch.
Code is mainly written in C ...
5
votes
1
answer
369
views
Custom object Cleaner for old JDK
I'm implementing a JNI library that needs to dispose a few native objects after use. The main library class implements Closeable and is almost always used within ...
5
votes
1
answer
534
views
Using templates to wrap variardic JNI method calls into type-safe C++ functors
I am working on a project which uses JNI. More than once I fell over the absence of type safety working with the variardic function calls. So I came up with this module. It wraps the variardic JNI ...
6
votes
1
answer
410
views
Design a native video buffer in C++ to be shown on android application and shared with other modules in native space and Java
I'm working on a design for a video buffer in C++ that will be used by many consumers both in the native library space(C++) as well as Java side using JNI. My Idea is the following:
Have a buffer ...
2
votes
2
answers
891
views
Production-ready comparison between byte-array and ByteBuffer
I want to compare the performance difference between using byte[] and ByteBuffer in Java, which approach I should use in my ...
4
votes
2
answers
301
views
Android NDK Low performance
I am trying to write a NDK program for quicksorting an array. However, in my benchmarks C is doing consistently worse than Java, as indicated by my results:
Java 1190625
C 1809218
Java 895104
C ...
2
votes
0
answers
776
views
A JavaFX for generating beeping sound on Windows via JNI
This is my practice program: a simple dialog box using which a user may specify a frequency of a sinus audio signal, and play it via pressing a button. It contains a GUI:
App.java
...
1
vote
1
answer
125
views
Optimizing loop - Reducing native calls
I am developing Android-Disassembler.
I need to optimize the loop below.
It is currectly calling native method for each instructions(about 4 bytes). So this loop will be looped about millions of ...
3
votes
2
answers
1k
views
Makefile for a small JNI project
So I'm going to publish this small project on GitHub and I thought I'd better do a makefile for it. The source code consists of
1 Java Class
1 Native JNI module written in C
1 stdlib wrapper object ...
4
votes
1
answer
109
views
Video frame to Minecraft map colors
I'm still somewhat new to C, so pardon me for any silly mistakes I've made.
I'm trying to convert video frames into Minecraft map colors using JNI and ...
6
votes
1
answer
663
views
Having fun with JNI: formatting a number
I attempted some (easy) coding with Java Native Interface. This is what I have:
six_pack_Neatifier.h:
(autogenerated by javah)
...