Is there a proper Java win32 library, for example, displaying current processes, finding out port numbers a process has taken, etc? (or something like a WMI library?)
Have a look at JNA. It's a 100% pure java way to communicate with native code.
They have a secondary lib named Platform.jar which packages some of the most common native API.
Althought I know what it is, I haven't used platform so I can't point out where you'll find what you're looking for. But from my global JNA experience this should help A LOT !!!
(end of answer)
For those who wonder how it works (it's explained on their homepage) ... well let's say they've handle the native part for you so that you can focus on the java end. The main librairy (jna.jar) bundles many native libs (.dll, .so, .dylib) for the major os / architectures and the java end to manipulate them (which explains the size of the jar : ~ 1 Mo).
when you want to use a multi OS lib name "A.dll", "A.so" or "libA.dylib" which contains the following :
int doSomething(char* aString ,byte* aByteArray, long* arraySize)
Just write the following and JNA will do the rest :
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)
}
and use it :
new LibAWrapper().doSomething("Hello World",....
Which means that if Platform.jar does not suit your needs it should be easy for you to write a wrapper around the native lib that you want
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With