Java Select a file in Windows Explorer?

I am working on a Java GUI in which I have a JTable in which I populated my file system, on JTable I have a context menu in the right click Like This

My JTable GUI

i right click on my file and it will open these folders in windows explorer to open the 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

myimage

I want it to open windows and my file should be selected in Windows Explorer.

enter image description here

thanks

+4
source share
2 answers

Do you think you know what parameters to use ?;)

EDIT: screams, it looks like you are not calling explorer by executing it. It seems that the working class does not have support for specifying parameters / parameters, so I assume that this is not feasible without using the Process class.

0
source

Watch this: Open Windows Explorer with the file selected in eclipse

enter image description here

If you want, for example, to select the folder (say) C: \ myFolder, simply replace it with the arguments:

 /select,C:\myFolder 
+2
source

All Articles