Mess with a systems hardware with Java?
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.
精彩评论