ahodder
ahodder

Reputation: 11439

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 harddrive? If so how far does this privilege go and do I need an API for it? Assuming that all system privileges allow for it.

Upvotes: 0

Views: 86

Answers (2)

DNA
DNA

Reputation: 42607

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.

Upvotes: 0

foxy
foxy

Reputation: 7672

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.

Upvotes: 1

Related Questions