jna

JNA - Set resource Path

陌路散爱 提交于 2019-12-10 19:59:59
问题 I am trying to set up JNA to talk to a custom DLL i have but to no avail It keeps saying it is looking in the resource path in the lcoation /target/classes/ I was wondering is it possible to add a resource location where it can pick up my DLL? My code is as follows System.setProperty("jna.debug_load", "true"); System.setProperty("jna.debug_load.jna", "true"); System.setProperty("jna.platform.library.path", "C:\\Development\\dll\\"); Native.loadLibrary("customDLL", CustomDLL.class); If I

Cassandra Startup failure on ARM64 machine (java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native)

亡梦爱人 提交于 2019-12-10 19:47:31
问题 When i am trying to start cassandra 3.9 and also 3.7 on ARM64 machine running 64 bit oracle JDK. But it is failing to start with no class def found error. There seems to be issue with JNA. However same is running fine on ARM32 machines. Below is the startup log of cassandra :- pi@DietPi:~/cassandra/apache-cassandra-3.9/conf$ ../bin/cassandra -f CompilerOracle: dontinline org/apache/cassandra/db/Columns$Serializer.deserializeLargeSubset (Lorg/apache/cassandra/io/util/DataInputPlus;Lorg/apache

Execute an executable program (.exe) from memory in Java

不羁岁月 提交于 2019-12-10 16:45:45
问题 I want to execute a program in memory on Windows. I do not want to write the file to disk. I just want to pass in a byte array (which is the program I want to execute) as a parameter. I am not skilled enough to write the native code to do this. Again, this should be Windows native. The program I want to execute in memory is not a Java program. It is an executable (.exe)! The executable is meant to be read and run IN MEMORY, not through Runtime.getRuntime().exec("example.exe"); 回答1: I can't

Using OS X 10.8 Notification Center (NSUserNotification) with Java

耗尽温柔 提交于 2019-12-10 15:58:06
问题 I'm struggling with the notification center in OS X 10.8. I wrote a wrapper to provide Java access to the NSUserNotification and NSUserNotificationCenter classes via JNA, however the functionality is limited. I am able to send a notification and it will display as long as the .jar is being run from an .app bundle via JavaApplicationStub. However, the line below is always logged to the console when the the notification style is set to "Alerts": 11/29/12 8:37:12.537 PM usernoted[162]: Failed to

File System Change Monitoring through Java

最后都变了- 提交于 2019-12-10 15:17:46
问题 I want to monitor changes with selected directories on my system through java. I have bit idea about watchservice in java 7. But watchservice only returns directory name to which change event (MODIFY, DELETE) occurs. On the other side, I want all information about change like user who made changes, time at which change takes place etc. It is something like a want to read change journals on NTFS file system. Is there any other way available in Java to record such changes asynchronously ? ...

Memory issues while loading two native libraries containing same symbols

一曲冷凌霜 提交于 2019-12-10 14:55:29
问题 I'm trying to operate a native, non-thread-safe Fortran library concurrently using JNA. As the library is not thread-safe, I try to instantiate different copies of the same library, but apparently they seem to share memory addresses. If I modify one variable in one library, the variable in the other library is modified to. This behavior makes it impossible to run them concurently in separate threads. The following code example demonstrates what I mean: code.f: subroutine set(var) implicit

JNA: java.lang.Error: Invalid memory access

…衆ロ難τιáo~ 提交于 2019-12-10 12:16:29
问题 I'm using JNA to access some dll function from Java, this dll Native Function is declared as the following: // it returns (long) H264_Login (char *sIP, unsigned short wPort, char *sUserName, char *sPassword, LP_DEVICEINFO lpDeviceInfo, int *error); // where LP_DEVICEINFO is a struct and so, I declared it inside library interface as the following: long H264_Login(String sIP, short wPort, String sUserName, String sPassword, Structure DeviceDate, int error); and then I call it the following way:

Java + JNA, looking for a way to run ShellExecuteW

穿精又带淫゛_ 提交于 2019-12-10 10:24:20
问题 I am trying to run a ShellExecute function from java with JNA. I dont have any problems running ShellExecuteA on non-unicode folders import com.sun.jna.*; import com.sun.jna.platform.win32.ShellAPI; import com.sun.jna.platform.win32.WinDef; import com.sun.jna.win32.*; public class Main { public interface Shell32 extends ShellAPI, StdCallLibrary { Shell32 INSTANCE = (Shell32)Native.loadLibrary("shell32", Shell32.class); WinDef.HINSTANCE ShellExecuteA(WinDef.HWND hwnd, String lpOperation,

Pointer to array of structures as JNA method arguments

喜欢而已 提交于 2019-12-10 09:28:11
问题 I am trying to create a JNA implementation over the SctpDrv library. My problem is that I don't get my head around pointers to structure arrays. I have tried to search for a solution, but they have always been slightly different from what I need to know. The JNA dokumentation only show an example with a pointer to an array of primitive type. There also seem to be different ways of doing this, of which some are depricated. int WSAAPI internal_sctp_getpaddrs (SOCKET, sctp_assoc_t, struct

JavaFX - How to detect Windows logoff/shutdown request?

霸气de小男生 提交于 2019-12-09 07:33:21
问题 I have an application that must process some methods upon exit. However, when the user shuts down Windows without first closing my application, Windows kills the app and the shutdown methods aren't run. How can I detect when the user has requested to shutdown or logoff of Windows? The methods I need to run take milliseconds to complete so I wouldn't need to postpone or interrupt the shutdown process, necessarily. I already use JNA to respond to the machine being locked/unlocked, but the