用java发出硬盘命令
有谁知道在Java中向硬盘发出命令的方法吗? Java 是否支持这种硬件交互?
例如,如果我想查询一个 SCSI 硬盘驱动器,是否有预先存在的 Java 方法可以执行此操作,或者我必须编写自己的方法?
http://en.wikipedia.org/wiki/SCSI 有一些有关 SCSI 命令的一般信息如果你不熟悉的话。
Does anyone know of a way to issue commands to a hard drive within Java? Does Java even support this kind of hardware interaction?
For example, if I have a SCSI hard drive that I would like to inquiry, is there a pre-existing Java method to do this, or would I have to write my own?
http://en.wikipedia.org/wiki/SCSI has some general information on SCSI commands in case you aren't familiar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Java 不支持像这样直接与硬件对话。 但是,您可以使用 JNI 从 Java 调用 C/C++ 函数。
Java doesn't support talking directly to hardware like that. However, you can use JNI to call a C/C++ function from Java that can.
三个词“JNI 或 JNA”。 我强烈建议您查看后者,看看它是否适合您的情况,而不是仅仅选择 JNI。
Three words "JNI or JNA". I strongly recommend taking a look at the latter to see if it suits your situation, instead of just opting for JNI.
不,因为 Java 运行在“虚拟”机器而不是真实机器中。 但它可以用作 dj 之前提到的使用 JNI 的桥梁。
根据 Wikipedia JNI 也可以直接调用程序集。 JNI可用于调用用C或C++编写的完整程序
No, since Java runs in a "virtual" machine rather than a real one. But it could be used as a bridge as dj mentioned earlier using JNI.
According to Wikipedia JNI can also call assembly directly. JNI could be used to call complete programs written in C or C++
您需要用 C/C++ 编写 HDD 接口代码,然后使用 JNI 从 Java 调用该代码
you need to write the HDD interface code in C/C++ and then call that from Java using JNI