Open Explorer - java

In one of the java swing applications, I dynamically open the Windows shared folder. Now I want to open it using explorer. So guys please help me solve it.

+7
source share
3 answers

If you are using Java 6, the best way to do this is to use Desktop :

 Desktop.getDesktop().open(new File(path)); 
+18
source

The following code will work on Windows (XP / Vista):

 Runtime.getRuntime().exec("explorer /select, " + folder); 
+4
source

I would advise against this approach .getRuntime() ... if you have a large application. This approach opens the process, so if you use it from a large program (for example, on an application server), the plug can eat all your available RAM.

+1
source

All Articles