Questions tagged [jna]

Java Native Access (JNA) provides pure Java access to native shared libraries without the need for additional native or JNI code.

Project website

Resources

1997 questions
119
votes
10 answers

Use JNI instead of JNA to call native code?

JNA seems a fair bit easier to use to call native code compared to JNI. In what cases would you use JNI over JNA?
Marcus Leon
  • 55,199
  • 118
  • 297
  • 429
62
votes
1 answer

How do I properly map a `MagImageScalingCallback` using JNA?

I am using jna.jar, jna-3.2.5.jar and jna-3.3.0-platform.jar in my Java Project. This is the Winapi function I want to replicate. BOOL WINAPI MagImageScalingCallback( _In_ HWND hwnd, _In_ void *srcdata, _In_ …
Vishnu
  • 11,614
  • 6
  • 51
  • 90
51
votes
1 answer

Understanding "corrupted size vs. prev_size" glibc error

I have implemented a JNA bridge to FDK-AAC. Source code can be found in here When bench-marking my code, I can get hundreds of successful runs on the same input, and then occasionally a C-level crash that'll kill the entire process, causing a…
Sheinbergon
  • 2,875
  • 1
  • 15
  • 26
43
votes
2 answers

Skip window from being captured

I have created an AIR application which has two windows. First one is main window(spark Windowed Application) and the second one is a component(spark window). I am using Java to capture the Desktop screen with Flex-Java Bridge Flerry. Here is the…
Vishnu
  • 11,614
  • 6
  • 51
  • 90
39
votes
4 answers

JNI vs. JNA performance

We have a native c/asm application utilizing GPU(OpenCL) for a big encrypt/decrypt data with a specific method, and it just works perfect, no problem. A part of the project (web and distribution) is been developing by JEE, and we just need to call…
user2889419
38
votes
2 answers

How to call a method in DLL in a Java program

I am trying to call a method in a DLL using JNA. So far have loaded the DLL using Runtime.getRuntime().load("myworkspace/test.dll"); This dll contaings a method that I need to access. How can I execute the method present in DLL in my Java file. Do…
Vivek
  • 2,091
  • 11
  • 46
  • 61
31
votes
3 answers

Getting active window information in Java

I am trying to upgrade my application in Java to work only if a window of process with certain name is active. I have found out that this is possible by using JNI, but I have no idea how exactly to do that. I just could not find any description or…
Erveron
  • 1,908
  • 2
  • 25
  • 48
29
votes
4 answers

Pinning a Java executable (with launch4j) to the Windows 7 taskbar

After spending half a day searching and trying, I'm finally giving up. I have a java application of which I create a runnable jar (to include any other libs and just have a single jar file). With launch4j and the runnable jar I'm making an…
ToFi
  • 1,167
  • 17
  • 29
25
votes
1 answer

Get events from OS

I work on windows but I am stuck here on Mac. I have the Canon SDK and have built a JNA wrapper over it. It works well on windows and need some help with Mac. In the sdk, there is a function where one can register a callback function. Basically when…
Jatin
  • 31,116
  • 15
  • 98
  • 163
23
votes
2 answers

How can I get system/hardware info via Java?

I need to get system and hardware info via a Java application. I'm interested in: Os details; Processors count, names, processor load in percents; Memory status (total/free); Os process (threads) count and CPU/Memory usage for each of them; Network…
Vladimir Kostyukov
  • 2,492
  • 3
  • 21
  • 30
21
votes
3 answers

Using JNA to get/set application identifier

Following up on my previous question concerning the Windows 7 taskbar, I would like to diagnose why Windows isn't acknowledging that my application is independent of javaw.exe. I presently have the following JNA code to obtain the…
Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187
19
votes
3 answers

JavaFX Minimizing Undecorated Stage

I have an undecorated JavaFX Stage, and my own minimize, maximize & close buttons. But unfortunately clicking the taskbar icon in Windows 7 does not automatically minimize the stage - compared to the decorated behaviour. Is there a way to minimize…
user2499946
  • 679
  • 1
  • 10
  • 28
17
votes
3 answers

How do JavaCL and JogAmp JOCL compare?

JavaCL uses JNA, JOCL uses JNI instead, so I expect JavaCL to show better cross-platform compatibility, while JOCL should generally turn out to have better performance. JOCL gets tested alongside JOGL2, which should make it easy to use GL objects in…
romeroabelleira
  • 468
  • 7
  • 20
16
votes
3 answers

How to automate Java bindings for Rust code?

I want to call Rust code from Java / Android, and I've found 3 variants to do so: JNI JNA JNR FFI JNI looks good and powerful enough, but you have to write too much code by hand. JNA, if not taking into consideration that it crashes on my machine,…
fghj
  • 8,898
  • 4
  • 28
  • 56
16
votes
2 answers

JNA Keyboard Hook in Windows

I have put together a JNA code for installing keyboard hook in Windows (using the JNA examples). The code compiles and everything, and I get the hook installed (I get handle to the hook successfully), also I can uninstall the hook successfully.…
temp
  • 485
  • 2
  • 5
  • 7
1
2 3
99 100