开发者

Java Select File in windows Explorer?

I am working on a Java GUI, in which i have a JTable in which i have populated my file system, on JTable i have a Right Click Context Menu Like This

Java Select File in windows Explorer?

i right click on m开发者_Python百科y File and it opens this folders in windows Explorer, to open a file/folder in windows explorer i am using this code

Desktop desktop = Desktop.getDesktop();
    if (Desktop.isDesktopSupported()) {
    }
    try {
        desktop.open(myFile); //myFile is my Selected File
    } catch (IOException e) {
    }

This opens myFile in windows Explorer Like this

Java Select File in windows Explorer?

i want that it should open windows and my file should be selected in windows explorer.

Java Select File in windows Explorer?

Thanks


See this: Open the windows explorer with a file selected in eclipse

Java Select File in windows Explorer?

If you want, for example, select the folder (let's say) C:\myFolder, just replace the arguments with:

/select,C:\myFolder


Do you think you know which options to use? ;)

EDIT: whoops, it looks like you don't call explorer by executing it. Desktop class seems have no support for specifying options/parameters, so I guess this is not doable without using Process class.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜