开发者

Getting WTSSessionId in a Java program

开发者 https://www.devze.com 2022-12-21 04:48 出处:网络
开发者_JAVA技巧Is there a way to get the value of the WTSSessionID parameter in a Java program. I am wondering if JNI is the only way to accomplish this ?Technically speaking, the answer to any questi
开发者_JAVA技巧

Is there a way to get the value of the WTSSessionID parameter in a Java program. I am wondering if JNI is the only way to accomplish this ?


Technically speaking, the answer to any question asking "...is JNI the only way?" is: No, it is not the only way. There are at least two alternatives to JNI. I've used JNA; there's another one called JNative; and who knows, there might be others. The advantage of these alternatives is that you don't have to create a new dll to act as a shim between Java and the native API.


There is no 100% Java way to obtain this Windows-specific value. You can execute a program and capture its output, or you can use JNI. You can use JNI with a DLL you write yourself, or you can use JNI with a tool (e.g. Jacob, JNA, or JNative), but in any of those cases you are invoking native code.

0

精彩评论

暂无评论...
验证码 换一张
取 消