views:

10

answers:

1

Hello,
is there functionality in java to open the containing folder of a file across any platform. I can accomplish 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.

+2  A: 

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

Burleigh Bear
Nice and simple. Thanks!
brian_d