开发者

Mess with a systems hardware with Java?

开发者 https://www.devze.com 2023-03-13 12:14 出处:网络
Is there a way that, using java, I can mess with my systems harware? Say like pop open the disk tray, eject a flash drive or even capture the data being read from a CD or being stored to a harddr开发者

Is there a way that, using java, I can mess with my systems harware? Say like pop open the disk tray, eject a flash drive or even capture the data being read from a CD or being stored to a harddr开发者_如何学编程ive? If so how far does this privilege go and do I need an API for it? Assuming that all system privileges allow for it.


Not within Java itself, because that isn't platform independent. People have used hacks in the past, the most common being calling some external VBScript (http://www.rgagnon.com/javadetails/java-0574.html).

You could also create your own native library and use JNI to invoke the function.


Not directly, but you can use JNI (http://en.wikipedia.org/wiki/Java_Native_Interface) or JNA (http://jna.java.net/) to access DLLs etc.

0

精彩评论

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

关注公众号