开发者

cross platform way to explore the containing folder of a file

is there functionality in java to open the containing folder of a file across any platform. I can accomplis开发者_如何学Pythonh this in windows by running

Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("explorer /select,c:\\sampleFile.txt");

You can open a file (if the Desktop api is supported) on any platform with java.awt.Desktop.getDesktop().open(file). Is there something similar to bring up a file manager?

Thanks.


What happens if you call getDesktop().open(file.getParentFile()) ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜