Java win32 libraries / api

Is there a proper win32 Java library, for example, displaying the current processes, finding out the port numbers that the process accepted, etc.? (or something like a WMI library?)

+3
source share
5 answers

Take a look at JNA . This is a 100% pure java way of communicating with native code.

They have a secondary library called Platform.jar , which contains some of the most common built-in APIs.

Although I know what it is, I have not used the platform, so I can not indicate where you will find what you are looking for. But from my global JNA experience, this should help A LOT !!!

(end of answer)


, , ( )... , , java. librairy (jna.jar) libs (.dll,.so,.dylib) os/ java-end ( jar: ~ 1 Mo).

"A.dll", "A.so" "libA.dylib", :

int doSomething(char* aString ,byte* aByteArray, long* arraySize)

, JNA :

public class LibAWrapper{
  //tell JNA to link with native library
  Native.register("A");
  //Type mapping in java 
  public native int doSomething(String aString ,byte[] aByteArray, NativeLongByReference arraySize)
}

:

new LibAWrapper().doSomething("Hello World",....

, Platform.jar , ,

+6
+2

JNA , JNI, . : JNA

+2

, jni- win32.

0

, , , - , .

Like others suggested, JNA seems to be the way to go. Since JNA (and the JNA Platform) do not display all methods in 1: 1 format, it is also possible to write your own API methods. We did this as described in the question. What is the best way to determine the number of GDI objects in a Java program?

0
source

Source: https://habr.com/ru/post/1781982/


All Articles