jna

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 AppUserModelID: public class AppIdTest { public static void main(String[] args) { NativeLibrar...

using jna with FAR PASCAL custom dll

Hi, I am using JNA to access a custom DLL which seems to be using the FAR PASCAL Calling Conventions, but the JVM crashes every time i try to access it. Development Guide of the dll says: BOOL FAR PASCAL GetIomemVersion(LPSTR); And Dependency Walker tells me: _GetIomemVersion@4 public class PebblePrinter{ public interface Iomem exte...

JNA - DsGetDcNameA

Hi, I am new to JNA, I want to convert DsGetDcName method to JNA. DWORD DsGetDcName( __in LPCTSTR ComputerName, __in LPCTSTR DomainName, __in GUID *DomainGuid, __in LPCTSTR SiteName, __in ULONG Flags, __out PDOMAIN_CONTROLLER_INFO *DomainControllerInfo ); I have converted the above function to JNA I replaced ab...

JNA Library - Problems on Mac OS X

This is a question regarding the JNA library in a Java program. I have a tray application. "JFrame 1" is loaded at start of program. "JFrame 1" has a custom shape and has transparency. (Custom shape = ellipse) It works on Windows, Linux and Mac OS X. BUT! When I open "JFrame 2" (a normal JFrame without custom shape and transparency), ...

Allocating a char buffer with JNA, Rhino, JavaScript

In Narwhal, we are using JNA to make libc calls like getcwd and chdir. I've only been able to use this with my limited knowledge of the JNA interface as it pertains to JavaScript in Rhino, dealing exclusively with primitives. I need to know how to allocate a char buffer so I can pass it to getcwd, retrieve a JavaScript String from that...

Java transparent JFrame, JVLC and java.awt.Canvas

I am trying to achieve an effect of transparent JFrame on top of video stream provided JVLC library. Background is an instance of java.awt.Canvas Foreground is my whatever JFrame with a couple of controls on it. rootPane.setForeground(myFrame); rootPane.setBackground(myCanvas); JVLC uses my canvas through JNA like this jvlc.setVideoOut...

Java Native Access doesn't do C++, right?!

I've found many references online (including some on stackoverflow) to JNA being used for C++ libraries, but nothing I can find in the JNA docs indicates that's possible. There doesn't seem to be any way to wrap a C++ class, in particular. I need native access to use RTAudio, but all of RTAudio's functions are member functions of the RT...

interpreting Java-native communication performance

Right now I'm using JNA for Java-native communication and am pleased with its simplicity. However I do need to optimize performance and am considering using other bindings. My question is this: what part of Java-native communication is the "expensive" part? Is it the passing of data between them? Let me put it another way. Right now t...

Advantages of using JNA over native process execution

I have a project that currently executes many native binaries using java.lang.Process. Assuming that their functionality is available in native library form - what would be the advantages of executing said library functions using JNA instead? The process executions are fairly heavy - they take a few seconds to complete. Am I correct in...

JNA equivalent of PVOID

what is the representation of PVOID in JNA? ...

JNA problem with char** (in dll)

Hi, ok it is 'easy' to make jna wrapper solution for mapping exported functions within dll using jna: long f1(int x), just int long f2(char* y), just char[] but how to deal with long f3(char** z) ? I need f3's result(long) as well as z value on java side. Please don't say cpp code should be rewritten to avoid this:-) ...

How do I make a target library available to my Java app?

Using JNA, the documentation says: Make your target library available to your Java program. There are two ways to do this: The preferred method is to set the jna.library.path system property to the path to your target library. This property is similar to java.library.path but only applies to libraries loaded by JNA. What does this ...

Java JNA cannot be initialized

I am trying to initialize Hunspell library using JNA on Tomcat 6.0 on Linux. On windows everything is fine, but on linux i have such exception: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native jar files of JNA and Hunspell are in tomcat/lib and in web-inf/lib of my app. Suggestions? Advices? ...

Using Xlib via JNA to move a window

I'm using JNA to manipulate application windows on Linux by sending Xlib messages but can't seem to move a window. My original implementation executed wmctrl on the shell to move the windows and that successfully moved the windows. Unfortunately, there's a noticeable amount of overhead associated with calling shell programs from Java, s...

JNA and ZBar(library for bar code reader)

I'm creating Java Interface with JNA for ZBar(library for bar code reader). In JNA, structures in C are needed to declare. For example:: // In C typedef struct { char* id; char* name; int age; char* sectionId } EMPLOYEE; to // In Java with JNA public static class Employee extends Structure { // com.sun.jna.Structure...

Java and gstreamer-java initialisation error

I am building a small app which will play streaming audio from the internet in java (mainly internet radio stations). I have decided to use the gstreamer-java library for the sound, which uses JNA. I would like to include a check in the code, to see whether the gstreamer library has been initialised. When I have left the "Gst.init()" co...

JNA with complicated struct

Ultimately I want to determine if the machine my program is running on is a laptop or desktop. I'd like to do this with JNA and msn's PowrProf lib, GetPwrCapabilities Function using the LidPresent flag. Part of the SYSTEM_POWER_CAPABILITIES struct (which is the argument for the GetPwrCapabilities method) BYTE spare...

writing a dll in Visual Studio in C (not C++) causing unresolved symbols

I've been going through the dll walkthrough on MSDN and it works fine. I then removed all the C++ style code in the dll and replaced it with the C equivalent, and it still works. BUT, when I rename the file from X.cpp to X.c (which I guess causes compilation in C-mode), I get error LNK2019 (unresolved external symbol) for every functio...

trying to make a "Hello Word" dll in Visual Studio that Java Native Access will accept

I've successfully compiled my library on Linux and Mac and used it with Java Native Access. Unfortunately nothing I do seems to work with Visual Studio's compiler and Java Native Access. I'm going back to the basics and trying to create a super simple dll in Visual Studio that Java Native Access will work with, any help would be appreci...

JNAerator Unnamed Union Missing in Structure

I'm trying to get JNAerator to generate some JNA backed Java code from a C shared library and everything is fine except that it failed to generate an unnamed union nested inside a structure. Example: typedef struct MY_STRUCTURE { union { My_Type1 var1; My_Type2 var2; }; }MY_STRUCTURE; If I change the header to make the u...