Hi,
I want a code for opening a particular folder or directory on button click.
Thanks.

The above question doesn't really specifies what you trying to achieve, but JFileChooser is something you should have look at, here is tutorial.
If this is not what you looking for, well then you need to provide more in detail description of you trying to achieve.

I am developing an application which generates an images as an output in specified directory path.
After generating that Images i want to open that specified directory on button click

If you mean you want to open it for general browsing in the OS (with Explorer for example), you'll have to use Runtime.exec() or ProcessBuilder for that.

If you mean you want to open it for general browsing in the OS (with Explorer for example), you'll have to use Runtime.exec() or ProcessBuilder for that.

Thank u
Ezzaral I got it

If you mean you want to open it for general browsing in the OS (with Explorer for example), you'll have to use Runtime.exec() or ProcessBuilder for that.

Isnt there a way like java Desktop API, it can browse with default browser, cant it open a directory?

Isnt there a way like java Desktop API, it can browse with default browser, cant it open a directory?

sorry I found my answer.

Desktop.open(File) does this task perfect.

sorry I found my answer.

Desktop.open(File) does this task perfect.

gangsta1903 can you paste the whole code or a link where you found the answer because I am stuck with the same problem.

thanks
bye

String path = "." // path to the directory to be opened   
		Desktop desktop = null;
		// Before more Desktop API is used, first check
		// whether the API is supported by this particular
		// virtual machine (VM) on this particular host.
		if (Desktop.isDesktopSupported()) {
			desktop = Desktop.getDesktop();
		}

		try {
			desktop.open(path);
		} catch (IOException e) {
		}

I want to know how to open a directory through a button in the jframe by chosing the path at run time. Can you please help me!

This question has already been answered. Start a new discussion instead.