How can I get a list of all mounted filesystems in Java on Unix?

后端 未结 6 1087
误落风尘
误落风尘 2020-12-10 19:38

I\'m running Java on a Unix platform. How can I get a list of all mounted filesystems via the Java 1.6 API?

I\'ve tried File.listRoots() but that return

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-10 20:09

    Java doesn't provide any access to mount points. You have to run system command mount via Runtime.exec() and parse its output. Either that, or parse the contents of /etc/mtab.

提交回复
热议问题