以编程方式从 Java 卸载驱动器
有谁知道如何在 OSx 中卸载 java 中的驱动器
我正在尝试从 java 卸载 sdcard。我正在使用 java Swing 类,驱动器会自动安装,但如何卸载它。
Does anyone knows how to unmount a drive in java in OSx
I am trying to unmount a sdcard from java. I am using java Swing class and the drive gets mounted automatically, but how do I unmount it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
挂载/卸载的概念与平台无关,因此它不直接存在于 Java API 中。您很可能必须使用 Runtime.exec() 发出命令行调用来卸载。
可能有开源库可以为您包装此 exec 调用,但是我不积极。
The concept of mounting/unmounting is not platform agnostic, so it doesn't exist directly within the Java APIs. You will most probably have to issue a command line call to unmount by using
Runtime.exec()
There might be open source libraries available that wrap this exec call for you, but I'm not positive.
您可以致电 umount 使用 Runtime.exec。当然,这个解决方案是不可移植的。
You could call umount using Runtime.exec. Of course, this solution is not portable.