Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Explorer - java

Tags:

java

swing

In one of my java swing application, I am dynamically open windows share folder. Now I want to open it using explorer. So can you guys please help me out to solve it.

like image 476
fengye Avatar asked Mar 20 '11 05:03

fengye


People also ask

How do I open Java Explorer?

To view the project explorer, click on Window menu then, click on Show View and select Project Explorer. There is simpler way to open project explorer, when you are in the editor press alt + shift + w and select project explorer.

What is open in Java?

The Java Desktop class contains an open() method that provides provision to open a file in Java. It is part of the java. awt package. Although Java is a platform-independent language, the Java Desktop class is platform-dependent. We need to check the system for Desktop support, before implementing this method.

How do I open a new folder in Java?

In Java, the mkdir() function is used to create a new directory. This method takes the abstract pathname as a parameter and is defined in the Java File class. mkdir() returns true if the directory is created successfully; else, it returns false​.


1 Answers

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

Desktop.getDesktop().open(new File(path));
like image 62
Thomas Avatar answered Sep 23 '22 12:09

Thomas