jna

JNA UnsatisfiedLinkError, but jna.library.path is set

我怕爱的太早我们不能终老 提交于 2019-12-18 04:12:46
问题 I'm using the following code to load a dll in JNA (irrelevant code is left out): public class JNAMain { public interface PointShapeBuffer extends Library { ... } public static void main(String[] args){ System.setProperty("jna.library.path", "c:\\jnadll"); System.setProperty("java.library.path", "c:\\jnadll"); PointShapeBuffer jna = (PointShapeBuffer) Native.loadLibrary("FileGDBAPI", PointShapeBuffer.class); } } And I get the following error: Exception in thread "main" java.lang

Unable to open the port by calling Native method from ITLSSPProc.dll

戏子无情 提交于 2019-12-17 20:45:43
问题 This is native method from ITLSSPProc.dll NOMANGLE int CCONV OpenSSPComPort (SSP_COMMAND * cmd); Here, SSP_COMMAND is structure in ITLSSPProc.dll which is in C++ Language. struct SSP_COMMAND { unsigned long BaudRate; unsigned char PortNumber; }; So, I have to access OpenSSPComPort (SSP_COMMAND * cmd) in java using JNI. Here is a code i have written, public class Main { public interface ITLSSPProc extends Library { ITLSSPProc INSTANCE = (ITLSSPProc) Native.loadLibrary( (Platform.isWindows() ?

Call DLL from Java using JNA

天大地大妈咪最大 提交于 2019-12-17 20:31:38
问题 I am new to accessing DLLs from Java using JNA. I need to access methods from a class within a DLL(written in .net). Form this sample DLL below, I am trying to get AuditID and Server ID. I am ending with the following error while I am running my code. Any guidance really appreciated. /// Error /// Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'GetEnrollcontext': The specified procedure could not be found. //DLL File Code// SampleDLL.ProfileEnroll

JavaFX Minimizing Undecorated Stage

Deadly 提交于 2019-12-17 18:33:44
问题 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 an undecorated stage with pure Java code, by clicking the taskbar icon? If not how can I do this with, say, JNA? EDIT: OK, I've been trying to solve this with JNA, but having done next to none C/C++/JNA, I have a bit trouble setting this up. I'd be

Trying to use DLL from Java (JNA). Unable to load library exception

怎甘沉沦 提交于 2019-12-17 07:47:45
问题 I have NetBeans project from tutorial which causes exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'simpleDLL': The specified module could not be found. Tried to put simpleDLL.dll in project libraries, copied file in system32 folder with no success. 回答1: I had exactly the same problem with loading a DLL, I solved it in this way: As Christian Kuetbach said, check if the simpleDLL you are using is compatible with your processor's architecture, a 32

JNA Keyboard Hook in Windows

ε祈祈猫儿з 提交于 2019-12-17 02:50:07
问题 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. However, the callback never get called when I press any key on the keyboard. Here is my code (most of it are type definitions got from the JNA examples, go to the "main" directly for my part) import com.sun.jna.IntegerType; import com.sun.jna.Pointer;

Java - Windows taskbar using JNA - How do I convert window icons (HICON) to java images?

会有一股神秘感。 提交于 2019-12-14 03:42:14
问题 I'm trying to add an application-switcher to a bigger project I'm working on. It needs to work on Windows XP/Vista/7/8. I'm using Java 1.7. Below is a sample application I created to demonstrate some of the problems I'm having. I'm very new to JNA. Thanks very much to 'Hovercraft Full of Eels' for this answer (and many others!) which forms the basis for the test application. Here are my questions: Image drawing - The images that I get from the window icons are being drawn in black and white.

Thread getting blocked in ReceiveNextEvent

别说谁变了你拦得住时间么 提交于 2019-12-14 03:24:30
问题 Using JNA, I have built an api to receive OS events from Mac using Carbon framework. Now, there is a function in Carbon.framework defined as: OSStatus ReceiveNextEvent ( ItemCount inNumTypes, //ItemCount is a 32-bit iteration count const EventTypeSpec *inList, //EventTypeSpec is a structure EventTimeout inTimeout,//EventTimeout is double-length integer of type EventTime Boolean inPullEvent, EventRef *outEvent ); The documentation says this: inNumTypes The number of event types to wait for (0

Call .dll functions using Java

那年仲夏 提交于 2019-12-14 03:11:51
问题 I need to write an application for a client that calls a method from a ".dll" file. The ".dll" file was previously executed manually from an ".exe" GUI but now they want to automate the process. I never worked with .dll files so everything that I found until now is the result of a complete day of research, I also received a small documentation with this tool: The interface is an ActiveX DLL which provides two functions (GetUnitInfo and SaveResult). In the moment I just want to run the

JNA Native.loadLibrary generates a memory failure: __memmove_avx_unaligned_erms

无人久伴 提交于 2019-12-13 19:17:31
问题 I develop an app in java that loads a C++ shared library using JNA. The detailed procedure is the following. Find library in the jar use System.load( C_LIBRARY_PATH ) with the result of step 1 Load library using JNA tools: Wrapper INSTANCE = Native.loadLibrary( C_LIBRARY_PATH, Wrapper.class ); This procedure is used to create a wrapper of the c++ library and hence produces a java library that is used for other projects. Point 1 and 2 are inspired by the work of adamheinrich. The existence of